@@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
4646 } ;
4747 // We only care about method calls corresponding to the `Clone`, `Deref` and `Borrow`
4848 // traits and ignore any other method call.
49- let ( trait_id , did) = match cx. typeck_results ( ) . type_dependent_def ( expr. hir_id ) {
49+ let did = match cx. typeck_results ( ) . type_dependent_def ( expr. hir_id ) {
5050 // Verify we are dealing with a method/associated function.
5151 Some ( ( DefKind :: AssocFn , did) ) => match cx. tcx . trait_of_item ( did) {
5252 // Check that we're dealing with a trait method for one of the traits we care about.
@@ -56,21 +56,22 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
5656 Some ( sym:: Borrow | sym:: Clone | sym:: Deref )
5757 ) =>
5858 {
59- ( trait_id , did)
59+ did
6060 }
6161 _ => return ,
6262 } ,
6363 _ => return ,
6464 } ;
65- let substs = cx. typeck_results ( ) . node_substs ( expr. hir_id ) ;
65+ let substs = cx
66+ . tcx
67+ . normalize_erasing_regions ( cx. param_env , cx. typeck_results ( ) . node_substs ( expr. hir_id ) ) ;
6668 if substs. needs_subst ( ) {
6769 // We can't resolve on types that require monomorphization, so we don't handle them if
6870 // we need to perform substitution.
6971 return ;
7072 }
71- let param_env = cx. tcx . param_env ( trait_id) ;
7273 // Resolve the trait method instance.
73- let Ok ( Some ( i) ) = ty:: Instance :: resolve ( cx. tcx , param_env, did, substs) else {
74+ let Ok ( Some ( i) ) = ty:: Instance :: resolve ( cx. tcx , cx . param_env , did, substs) else {
7475 return
7576 } ;
7677 // (Re)check that it implements the noop diagnostic.
0 commit comments