File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -2004,13 +2004,8 @@ impl<'tcx> TyCtxt<'tcx> {
20042004 /// If the given `DefId` describes a method belonging to an impl, returns the
20052005 /// `DefId` of the impl that the method belongs to; otherwise, returns `None`.
20062006 pub fn impl_of_method ( self , def_id : DefId ) -> Option < DefId > {
2007- if let DefKind :: AssocConst | DefKind :: AssocFn | DefKind :: AssocTy = self . def_kind ( def_id) {
2008- let parent = self . parent ( def_id) ;
2009- if let DefKind :: Impl { .. } = self . def_kind ( parent) {
2010- return Some ( parent) ;
2011- }
2012- }
2013- None
2007+ self . opt_parent ( def_id)
2008+ . filter ( |parent| matches ! ( self . def_kind( parent) , DefKind :: Impl { .. } ) )
20142009 }
20152010
20162011 pub fn is_exportable ( self , def_id : DefId ) -> bool {
You can’t perform that action at this time.
0 commit comments