@@ -394,7 +394,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
394
394
return ;
395
395
}
396
396
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 ) =
398
398
if let hir:: PatKind :: Path ( hir:: QPath :: Resolved (
399
399
None ,
400
400
hir:: Path {
@@ -417,7 +417,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
417
417
res,
418
418
}
419
419
} ,
420
- None , None ,
420
+ None ,
421
421
)
422
422
} else if let Some ( span) = sp && self . tcx . sess . source_map ( ) . is_span_accessible ( span) {
423
423
let mut bindings = vec ! [ ] ;
@@ -430,19 +430,11 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
430
430
let start_span = span. shrink_to_lo ( ) ;
431
431
let end_span = semi_span. shrink_to_lo ( ) ;
432
432
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) )
444
436
} else {
445
- ( sp. map ( |_|Inform ) , None , None , None , None )
437
+ ( sp. map ( |_|Inform ) , None , None , None )
446
438
} ;
447
439
448
440
let adt_defined_here = try {
@@ -465,8 +457,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
465
457
interpreted_as_const,
466
458
_p : ( ) ,
467
459
pattern_ty,
468
- if_let_suggestion,
469
- let_else_suggestion,
460
+ let_suggestion,
470
461
res_defined_here,
471
462
adt_defined_here,
472
463
} ) ;
0 commit comments