@@ -669,9 +669,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
669
669
}
670
670
671
671
let ident_kind = match binding_parent {
672
- hir:: Node :: Param ( _) => Some ( "parameter" ) ,
673
- hir:: Node :: Local ( _) => Some ( "variable" ) ,
674
- hir:: Node :: Arm ( _) => Some ( "binding" ) ,
672
+ hir:: Node :: Param ( _) => "parameter" ,
673
+ hir:: Node :: Local ( _) => "variable" ,
674
+ hir:: Node :: Arm ( _) => "binding" ,
675
675
676
676
// Provide diagnostics only if the parent pattern is struct-like,
677
677
// i.e. where `mut binding` makes sense
@@ -680,24 +680,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
680
680
| PatKind :: TupleStruct ( ..)
681
681
| PatKind :: Or ( ..)
682
682
| PatKind :: Tuple ( ..)
683
- | PatKind :: Slice ( ..) => Some ( "binding" ) ,
683
+ | PatKind :: Slice ( ..) => "binding" ,
684
684
685
685
PatKind :: Wild
686
686
| PatKind :: Binding ( ..)
687
687
| PatKind :: Path ( ..)
688
688
| PatKind :: Box ( ..)
689
689
| PatKind :: Ref ( ..)
690
690
| PatKind :: Lit ( ..)
691
- | PatKind :: Range ( ..) => None ,
691
+ | PatKind :: Range ( ..) => break ' block None ,
692
692
} ,
693
693
694
694
// Don't provide suggestions in other cases
695
- _ => None ,
695
+ _ => break ' block None ,
696
696
} ;
697
697
698
- ident_kind . map ( |thing| (
698
+ Some ( (
699
699
pat. span ,
700
- format ! ( "to declare a mutable {thing } use `mut variable_name`" ) ,
700
+ format ! ( "to declare a mutable {ident_kind } use `mut variable_name`" ) ,
701
701
format ! ( "mut {binding}" ) ,
702
702
) )
703
703
0 commit comments