11use clippy_utils:: diagnostics:: span_lint_and_then;
22use 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 ;
54use rustc_hir:: { Impl , ImplItem , ImplItemKind , ItemKind , Node , TraitRef } ;
65use rustc_lint:: LateContext ;
76use rustc_span:: Span ;
@@ -18,7 +17,7 @@ pub(super) fn check_impl_item(cx: &LateContext<'_>, item: &ImplItem<'_>, ignored
1817 of_trait : Some ( of_trait) ,
1918 ..
2019 } ) = & 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 )
2221 && !is_from_ignored_trait ( & of_trait. trait_ref , ignored_traits)
2322 {
2423 let mut param_idents_iter = cx. tcx . hir_body_param_idents ( body_id) ;
@@ -91,11 +90,6 @@ impl RenamedFnArgs {
9190 }
9291}
9392
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-
9993fn is_from_ignored_trait ( of_trait : & TraitRef < ' _ > , ignored_traits : & DefIdSet ) -> bool {
10094 let Some ( trait_did) = of_trait. trait_def_id ( ) else {
10195 return false ;
0 commit comments