@@ -394,7 +394,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
394394 return ;
395395 }
396396
397- let ( inform, interpreted_as_const, res_defined_here, if_let_suggestion , let_else_suggestion ) =
397+ let ( inform, interpreted_as_const, res_defined_here, let_suggestion ) =
398398 if let hir:: PatKind :: Path ( hir:: QPath :: Resolved (
399399 None ,
400400 hir:: Path {
@@ -417,7 +417,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
417417 res,
418418 }
419419 } ,
420- None , None ,
420+ None ,
421421 )
422422 } else if let Some ( span) = sp && self . tcx . sess . source_map ( ) . is_span_accessible ( span) {
423423 let mut bindings = vec ! [ ] ;
@@ -430,19 +430,11 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
430430 let start_span = span. shrink_to_lo ( ) ;
431431 let end_span = semi_span. shrink_to_lo ( ) ;
432432 let count = witnesses. len ( ) ;
433- let if_let = match * bindings {
434- [ ] => SuggestIfLet :: None { start_span, semi_span, count} ,
435- [ binding] => SuggestIfLet :: One { start_span, end_span, count, binding } ,
436- _ => SuggestIfLet :: More { start_span, end_span, count, bindings : bindings
437- . iter ( )
438- . map ( |ident| ident. to_string ( ) )
439- . collect :: < Vec < _ > > ( )
440- . join ( ", " ) } ,
441- } ;
442- let let_else = if bindings. is_empty ( ) { None } else { Some ( SuggestLetElse { end_span, count } ) } ;
443- ( sp. map ( |_|Inform ) , None , None , Some ( if_let) , let_else)
433+
434+ let let_suggestion = if bindings. is_empty ( ) { SuggestLet :: If { start_span, semi_span, count} } else { SuggestLet :: Else { end_span, count } } ;
435+ ( sp. map ( |_|Inform ) , None , None , Some ( let_suggestion) )
444436 } else {
445- ( sp. map ( |_|Inform ) , None , None , None , None )
437+ ( sp. map ( |_|Inform ) , None , None , None )
446438 } ;
447439
448440 let adt_defined_here = try {
@@ -465,8 +457,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
465457 interpreted_as_const,
466458 _p : ( ) ,
467459 pattern_ty,
468- if_let_suggestion,
469- let_else_suggestion,
460+ let_suggestion,
470461 res_defined_here,
471462 adt_defined_here,
472463 } ) ;
0 commit comments