@@ -35,7 +35,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3535use rustc_data_structures:: sync:: { self , par_iter, Lrc , ParallelIterator } ;
3636use rustc_hir as hir;
3737use rustc_hir:: def:: { CtorKind , CtorOf , DefKind , Namespace , Res } ;
38- use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , LocalDefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
38+ use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , LocalDefId , CRATE_DEF_INDEX } ;
3939use rustc_hir:: { Constness , GlobMap , Node , TraitMap } ;
4040use rustc_index:: vec:: { Idx , IndexVec } ;
4141use rustc_macros:: HashStable ;
@@ -3054,17 +3054,7 @@ impl<'tcx> TyCtxt<'tcx> {
30543054 /// If the given defid describes a method belonging to an impl, returns the
30553055 /// `DefId` of the impl that the method belongs to; otherwise, returns `None`.
30563056 pub fn impl_of_method ( self , def_id : DefId ) -> Option < DefId > {
3057- let item = if def_id. krate != LOCAL_CRATE {
3058- if let Some ( DefKind :: AssocFn ) = self . def_kind ( def_id) {
3059- Some ( self . associated_item ( def_id) )
3060- } else {
3061- None
3062- }
3063- } else {
3064- self . opt_associated_item ( def_id)
3065- } ;
3066-
3067- item. and_then ( |trait_item| match trait_item. container {
3057+ self . opt_associated_item ( def_id) . and_then ( |trait_item| match trait_item. container {
30683058 TraitContainer ( _) => None ,
30693059 ImplContainer ( def_id) => Some ( def_id) ,
30703060 } )
0 commit comments