1
1
use clippy_utils:: diagnostics:: span_lint_and_then;
2
2
use rustc_errors:: { Applicability , MultiSpan } ;
3
- use rustc_hir:: def_id:: { DefId , DefIdSet } ;
4
- use rustc_hir:: hir_id:: OwnerId ;
3
+ use rustc_hir:: def_id:: DefIdSet ;
5
4
use rustc_hir:: { Impl , ImplItem , ImplItemKind , ItemKind , Node , TraitRef } ;
6
5
use rustc_lint:: LateContext ;
7
6
use rustc_span:: Span ;
@@ -18,7 +17,7 @@ pub(super) fn check_impl_item(cx: &LateContext<'_>, item: &ImplItem<'_>, ignored
18
17
of_trait : Some ( of_trait) ,
19
18
..
20
19
} ) = & parent_item. kind
21
- && let Some ( did) = trait_item_def_id_of_impl ( cx , item. owner_id )
20
+ && let Some ( did) = cx . tcx . trait_item_of ( item. owner_id )
22
21
&& !is_from_ignored_trait ( & of_trait. trait_ref , ignored_traits)
23
22
{
24
23
let mut param_idents_iter = cx. tcx . hir_body_param_idents ( body_id) ;
@@ -91,11 +90,6 @@ impl RenamedFnArgs {
91
90
}
92
91
}
93
92
94
- /// Get the [`trait_item_def_id`](ImplItemRef::trait_item_def_id) of a relevant impl item.
95
- fn trait_item_def_id_of_impl ( cx : & LateContext < ' _ > , target : OwnerId ) -> Option < DefId > {
96
- cx. tcx . associated_item ( target) . trait_item_def_id
97
- }
98
-
99
93
fn is_from_ignored_trait ( of_trait : & TraitRef < ' _ > , ignored_traits : & DefIdSet ) -> bool {
100
94
let Some ( trait_did) = of_trait. trait_def_id ( ) else {
101
95
return false ;
0 commit comments