@@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
46
46
} ;
47
47
// We only care about method calls corresponding to the `Clone`, `Deref` and `Borrow`
48
48
// 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 ) {
50
50
// Verify we are dealing with a method/associated function.
51
51
Some ( ( DefKind :: AssocFn , did) ) => match cx. tcx . trait_of_item ( did) {
52
52
// 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 {
56
56
Some ( sym:: Borrow | sym:: Clone | sym:: Deref )
57
57
) =>
58
58
{
59
- ( trait_id , did)
59
+ did
60
60
}
61
61
_ => return ,
62
62
} ,
63
63
_ => return ,
64
64
} ;
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 ) ) ;
66
68
if substs. needs_subst ( ) {
67
69
// We can't resolve on types that require monomorphization, so we don't handle them if
68
70
// we need to perform substitution.
69
71
return ;
70
72
}
71
- let param_env = cx. tcx . param_env ( trait_id) ;
72
73
// 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 {
74
75
return
75
76
} ;
76
77
// (Re)check that it implements the noop diagnostic.
0 commit comments