@@ -35,7 +35,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
35
35
use rustc_data_structures:: sync:: { self , par_iter, Lrc , ParallelIterator } ;
36
36
use rustc_hir as hir;
37
37
use 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 } ;
39
39
use rustc_hir:: { Constness , GlobMap , Node , TraitMap } ;
40
40
use rustc_index:: vec:: { Idx , IndexVec } ;
41
41
use rustc_macros:: HashStable ;
@@ -3054,17 +3054,7 @@ impl<'tcx> TyCtxt<'tcx> {
3054
3054
/// If the given defid describes a method belonging to an impl, returns the
3055
3055
/// `DefId` of the impl that the method belongs to; otherwise, returns `None`.
3056
3056
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 {
3068
3058
TraitContainer ( _) => None ,
3069
3059
ImplContainer ( def_id) => Some ( def_id) ,
3070
3060
} )
0 commit comments