@@ -384,7 +384,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
384
384
} else {
385
385
span = item_name. span ;
386
386
387
- // issue #81576, elision of generic argument when no methode can be found in any implementation
387
+ // Don't show generic arguments when the method can't be found in any implementation (#81576).
388
388
let mut ty_str_reported = ty_str. clone ( ) ;
389
389
if let ty:: Adt ( _, ref generics) = actual. kind ( ) {
390
390
if generics. len ( ) > 0 {
@@ -493,22 +493,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
493
493
self . associated_item ( * def_id, item_name, Namespace :: ValueNS )
494
494
{
495
495
// Check for both mode is the same so we avoid suggesting
496
- // incorect associated item.
497
- match ( mode, assoc. fn_has_self_parameter ) {
498
- ( Mode :: MethodCall , true ) => {
499
- if let SelfSource :: MethodCall ( _) = source {
500
- // We check that the suggest type is actually
501
- // different from the received one
502
- // So we avoid suggestion method with Box<Self>
503
- // for instance
504
- self . tcx . at ( span) . type_of ( * def_id) != actual
505
- && self . tcx . at ( span) . type_of ( * def_id)
506
- != rcvr_ty
507
- } else {
508
- false
509
- }
496
+ // incorrect associated item.
497
+ match ( mode, assoc. fn_has_self_parameter , source) {
498
+ ( Mode :: MethodCall , true , SelfSource :: MethodCall ( _) ) => {
499
+ // We check that the suggest type is actually
500
+ // different from the received one
501
+ // So we avoid suggestion method with Box<Self>
502
+ // for instance
503
+ self . tcx . at ( span) . type_of ( * def_id) != actual
504
+ && self . tcx . at ( span) . type_of ( * def_id)
505
+ != rcvr_ty
510
506
}
511
- ( Mode :: Path , false ) => true ,
507
+ ( Mode :: Path , false , _ ) => true ,
512
508
_ => false ,
513
509
}
514
510
} else {
@@ -521,7 +517,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
521
517
inherent_impls_candidate. dedup ( ) ;
522
518
// number of type to shows at most.
523
519
const LIMIT : usize = 3 ;
524
- let mut note = format ! ( "The {item_kind} was found for" ) ;
520
+ let mut note = format ! ( "the {item_kind} was found for" ) ;
525
521
if inherent_impls_candidate. len ( ) > 1 {
526
522
for impl_item in inherent_impls_candidate. iter ( ) . take ( LIMIT - 2 )
527
523
{
0 commit comments