@@ -3,7 +3,7 @@ use clippy_utils::mir::{enclosing_mir, expr_local, local_assignments, used_exact
3
3
use clippy_utils:: msrvs:: { self , Msrv } ;
4
4
use clippy_utils:: source:: { snippet_with_applicability, snippet_with_context} ;
5
5
use clippy_utils:: sugg:: has_enclosing_paren;
6
- use clippy_utils:: ty:: { is_copy, peel_mid_ty_refs} ;
6
+ use clippy_utils:: ty:: { implements_trait , is_copy, peel_mid_ty_refs} ;
7
7
use clippy_utils:: {
8
8
expr_use_ctxt, get_parent_expr, get_parent_node, is_lint_allowed, path_to_local, DefinedTy , ExprUseNode ,
9
9
} ;
@@ -33,7 +33,6 @@ use rustc_middle::ty::{
33
33
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
34
34
use rustc_span:: symbol:: sym;
35
35
use rustc_span:: { Span , Symbol } ;
36
- use rustc_trait_selection:: infer:: InferCtxtExt as _;
37
36
use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
38
37
use rustc_trait_selection:: traits:: { Obligation , ObligationCause } ;
39
38
use std:: collections:: VecDeque ;
@@ -452,13 +451,12 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
452
451
// Trait methods taking `self`
453
452
arg_ty
454
453
} && impl_ty. is_ref ( )
455
- && cx. tcx . infer_ctxt ( ) . build ( )
456
- . type_implements_trait (
457
- trait_id,
458
- [ impl_ty. into ( ) ] . into_iter ( ) . chain ( args. iter ( ) . copied ( ) ) ,
459
- cx. param_env ,
460
- )
461
- . must_apply_modulo_regions ( )
454
+ && implements_trait (
455
+ cx,
456
+ impl_ty,
457
+ trait_id,
458
+ & args[ ..cx. tcx . generics_of ( trait_id) . params . len ( ) - 1 ] ,
459
+ )
462
460
{
463
461
false
464
462
} else {
0 commit comments