@@ -420,20 +420,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
420420 . steal_diagnostic ( segment. ident . span , StashKey :: CallIntoMethod )
421421 {
422422 // Try suggesting `foo(a)` -> `a.foo()` if possible.
423- if let Some ( ty) =
424- self . suggest_call_as_method (
425- & mut diag,
426- segment,
427- arg_exprs,
428- call_expr,
429- expected
430- )
431- {
432- diag. emit ( ) ;
433- return ty;
434- } else {
435- diag. emit ( ) ;
436- }
423+ self . suggest_call_as_method (
424+ & mut diag,
425+ segment,
426+ arg_exprs,
427+ call_expr,
428+ expected
429+ ) ;
430+ diag. emit ( ) ;
437431 }
438432
439433 let err = self . report_invalid_callee ( call_expr, callee_expr, callee_ty, arg_exprs) ;
@@ -496,9 +490,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
496490 arg_exprs : & ' tcx [ hir:: Expr < ' tcx > ] ,
497491 call_expr : & ' tcx hir:: Expr < ' tcx > ,
498492 expected : Expectation < ' tcx > ,
499- ) -> Option < Ty < ' tcx > > {
493+ ) {
500494 if let [ callee_expr, rest @ ..] = arg_exprs {
501- let callee_ty = self . typeck_results . borrow ( ) . expr_ty_adjusted_opt ( callee_expr) ?;
495+ let Some ( callee_ty) = self . typeck_results . borrow ( ) . expr_ty_adjusted_opt ( callee_expr) else {
496+ return ;
497+ } ;
502498
503499 // First, do a probe with `IsSuggestion(true)` to avoid emitting
504500 // any strange errors. If it's successful, then we'll do a true
@@ -513,7 +509,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
513509 ProbeScope :: AllTraits ,
514510 expected. only_has_type ( self ) ,
515511 ) else {
516- return None ;
512+ return ;
517513 } ;
518514
519515 let pick = self . confirm_method (
@@ -525,7 +521,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
525521 segment,
526522 ) ;
527523 if pick. illegal_sized_bound . is_some ( ) {
528- return None ;
524+ return ;
529525 }
530526
531527 let up_to_rcvr_span = segment. ident . span . until ( callee_expr. span ) ;
@@ -567,22 +563,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
567563 sugg,
568564 Applicability :: MaybeIncorrect ,
569565 ) ;
570-
571- // Let's check the method fully now
572- let return_ty = self . check_method_argument_types (
573- segment. ident . span ,
574- call_expr,
575- Ok ( pick. callee ) ,
576- rest,
577- TupleArgumentsFlag :: DontTupleArguments ,
578- expected,
579- ) ;
580-
581- return Some ( return_ty) ;
582566 }
583567 }
584-
585- None
586568 }
587569
588570 fn report_invalid_callee (
0 commit comments