@@ -1370,17 +1370,10 @@ crate enum FnRetTy {
13701370 DefaultReturn ,
13711371}
13721372
1373- impl GetDefId for FnRetTy {
1374- fn def_id ( & self ) -> Option < DefId > {
1375- match * self {
1376- Return ( ref ty) => ty. def_id ( ) ,
1377- DefaultReturn => None ,
1378- }
1379- }
1380-
1381- fn def_id_full ( & self , cache : & Cache ) -> Option < DefId > {
1382- match * self {
1383- Return ( ref ty) => ty. def_id_full ( cache) ,
1373+ impl FnRetTy {
1374+ crate fn as_return ( & self ) -> Option < & Type > {
1375+ match self {
1376+ Return ( ret) => Some ( ret) ,
13841377 DefaultReturn => None ,
13851378 }
13861379 }
@@ -1458,34 +1451,6 @@ crate enum Type {
14581451#[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
14591452rustc_data_structures:: static_assert_size!( Type , 72 ) ;
14601453
1461- crate trait GetDefId {
1462- /// Use this method to get the [`DefId`] of a [`clean`] AST node.
1463- /// This will return [`None`] when called on a primitive [`clean::Type`].
1464- /// Use [`Self::def_id_full`] if you want to include primitives.
1465- ///
1466- /// [`clean`]: crate::clean
1467- /// [`clean::Type`]: crate::clean::Type
1468- // FIXME: get rid of this function and always use `def_id_full`
1469- fn def_id ( & self ) -> Option < DefId > ;
1470-
1471- /// Use this method to get the [DefId] of a [clean] AST node, including [PrimitiveType]s.
1472- ///
1473- /// See [`Self::def_id`] for more.
1474- ///
1475- /// [clean]: crate::clean
1476- fn def_id_full ( & self , cache : & Cache ) -> Option < DefId > ;
1477- }
1478-
1479- impl < T : GetDefId > GetDefId for Option < T > {
1480- fn def_id ( & self ) -> Option < DefId > {
1481- self . as_ref ( ) . and_then ( |d| d. def_id ( ) )
1482- }
1483-
1484- fn def_id_full ( & self , cache : & Cache ) -> Option < DefId > {
1485- self . as_ref ( ) . and_then ( |d| d. def_id_full ( cache) )
1486- }
1487- }
1488-
14891454impl Type {
14901455 crate fn primitive_type ( & self ) -> Option < PrimitiveType > {
14911456 match * self {
@@ -1564,17 +1529,27 @@ impl Type {
15641529 QPath { ref self_type, .. } => return self_type. inner_def_id ( cache) ,
15651530 Generic ( _) | Infer | ImplTrait ( _) => return None ,
15661531 } ;
1567- cache. and_then ( |c| Primitive ( t) . def_id_full ( c) )
1532+ cache. and_then ( |c| Primitive ( t) . def_id ( c) )
15681533 }
1569- }
15701534
1571- impl GetDefId for Type {
1572- fn def_id ( & self ) -> Option < DefId > {
1573- self . inner_def_id ( None )
1535+ /// Use this method to get the [DefId] of a [clean] AST node, including [PrimitiveType]s.
1536+ ///
1537+ /// See [`Self::def_id_no_primitives`] for more.
1538+ ///
1539+ /// [clean]: crate::clean
1540+ crate fn def_id ( & self , cache : & Cache ) -> Option < DefId > {
1541+ self . inner_def_id ( Some ( cache) )
15741542 }
15751543
1576- fn def_id_full ( & self , cache : & Cache ) -> Option < DefId > {
1577- self . inner_def_id ( Some ( cache) )
1544+ /// Use this method to get the [`DefId`] of a [`clean`] AST node.
1545+ /// This will return [`None`] when called on a primitive [`clean::Type`].
1546+ /// Use [`Self::def_id`] if you want to include primitives.
1547+ ///
1548+ /// [`clean`]: crate::clean
1549+ /// [`clean::Type`]: crate::clean::Type
1550+ // FIXME: get rid of this function and always use `def_id`
1551+ crate fn def_id_no_primitives ( & self ) -> Option < DefId > {
1552+ self . inner_def_id ( None )
15781553 }
15791554}
15801555
@@ -2092,16 +2067,6 @@ crate struct Typedef {
20922067 crate item_type : Option < Type > ,
20932068}
20942069
2095- impl GetDefId for Typedef {
2096- fn def_id ( & self ) -> Option < DefId > {
2097- self . type_ . def_id ( )
2098- }
2099-
2100- fn def_id_full ( & self , cache : & Cache ) -> Option < DefId > {
2101- self . type_ . def_id_full ( cache)
2102- }
2103- }
2104-
21052070#[ derive( Clone , Debug ) ]
21062071crate struct OpaqueTy {
21072072 crate bounds : Vec < GenericBound > ,
0 commit comments