@@ -420,20 +420,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
420
420
. steal_diagnostic ( segment. ident . span , StashKey :: CallIntoMethod )
421
421
{
422
422
// 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 ( ) ;
437
431
}
438
432
439
433
let err = self . report_invalid_callee ( call_expr, callee_expr, callee_ty, arg_exprs) ;
@@ -496,9 +490,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
496
490
arg_exprs : & ' tcx [ hir:: Expr < ' tcx > ] ,
497
491
call_expr : & ' tcx hir:: Expr < ' tcx > ,
498
492
expected : Expectation < ' tcx > ,
499
- ) -> Option < Ty < ' tcx > > {
493
+ ) {
500
494
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
+ } ;
502
498
503
499
// First, do a probe with `IsSuggestion(true)` to avoid emitting
504
500
// any strange errors. If it's successful, then we'll do a true
@@ -513,7 +509,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
513
509
ProbeScope :: AllTraits ,
514
510
expected. only_has_type ( self ) ,
515
511
) else {
516
- return None ;
512
+ return ;
517
513
} ;
518
514
519
515
let pick = self . confirm_method (
@@ -525,7 +521,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
525
521
segment,
526
522
) ;
527
523
if pick. illegal_sized_bound . is_some ( ) {
528
- return None ;
524
+ return ;
529
525
}
530
526
531
527
let up_to_rcvr_span = segment. ident . span . until ( callee_expr. span ) ;
@@ -567,22 +563,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
567
563
sugg,
568
564
Applicability :: MaybeIncorrect ,
569
565
) ;
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) ;
582
566
}
583
567
}
584
-
585
- None
586
568
}
587
569
588
570
fn report_invalid_callee (
0 commit comments