@@ -563,8 +563,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
563563 } ;
564564
565565 let suggest_confusable = |err : & mut Diagnostic | {
566- let call_name = call_ident?;
567- let callee_ty = callee_ty?;
566+ let Some ( call_name) = call_ident else {
567+ return ;
568+ } ;
569+ let Some ( callee_ty) = callee_ty else {
570+ return ;
571+ } ;
568572 let input_types: Vec < Ty < ' _ > > = provided_arg_tys. iter ( ) . map ( |( ty, _) | * ty) . collect ( ) ;
569573 // Check for other methods in the following order
570574 // - methods marked as `rustc_confusables` with the provided arguments
@@ -573,13 +577,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
573577 // - methods with short levenshtein distance
574578
575579 // Look for commonly confusable method names considering arguments.
576- if let Some ( name ) = self . confusable_method_name (
580+ if let Some ( _name ) = self . confusable_method_name (
577581 err,
578582 callee_ty. peel_refs ( ) ,
579583 call_name,
580584 Some ( input_types. clone ( ) ) ,
581585 ) {
582- return Some ( name ) ;
586+ return ;
583587 }
584588 // Look for method names with short levenshtein distance, considering arguments.
585589 if let Some ( ( assoc, fn_sig) ) = similar_assoc ( call_name)
@@ -595,13 +599,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
595599 assoc. name ,
596600 Applicability :: MaybeIncorrect ,
597601 ) ;
598- return Some ( assoc . name ) ;
602+ return ;
599603 }
600604 // Look for commonly confusable method names disregarding arguments.
601- if let Some ( name ) =
605+ if let Some ( _name ) =
602606 self . confusable_method_name ( err, callee_ty. peel_refs ( ) , call_name, None )
603607 {
604- return Some ( name ) ;
608+ return ;
605609 }
606610 // Look for similarly named methods with levenshtein distance with the right
607611 // number of arguments.
@@ -615,7 +619,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
615619 assoc. name,
616620 ) ,
617621 ) ;
618- return Some ( assoc . name ) ;
622+ return ;
619623 }
620624 // Fallthrough: look for similarly named methods with levenshtein distance.
621625 if let Some ( ( assoc, _) ) = similar_assoc ( call_name) {
@@ -627,9 +631,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
627631 assoc. name,
628632 ) ,
629633 ) ;
630- return Some ( assoc . name ) ;
634+ return ;
631635 }
632- None
633636 } ;
634637 // A "softer" version of the `demand_compatible`, which checks types without persisting them,
635638 // and treats error types differently
0 commit comments