@@ -1774,25 +1774,26 @@ impl<'tcx> Clean<'tcx, Constant> for ty::Const<'tcx> {
1774
1774
}
1775
1775
}
1776
1776
1777
- impl < ' tcx > Clean < ' tcx , Item > for hir:: FieldDef < ' tcx > {
1778
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Item {
1779
- let def_id = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) . to_def_id ( ) ;
1780
- clean_field ( def_id, self . ident . name , clean_ty ( self . ty , cx) , cx)
1781
- }
1777
+ pub ( crate ) fn clean_field < ' tcx > ( field : & hir:: FieldDef < ' tcx > , cx : & mut DocContext < ' tcx > ) -> Item {
1778
+ let def_id = cx. tcx . hir ( ) . local_def_id ( field. hir_id ) . to_def_id ( ) ;
1779
+ clean_field_with_def_id ( def_id, field. ident . name , clean_ty ( field. ty , cx) , cx)
1782
1780
}
1783
1781
1784
- impl < ' tcx > Clean < ' tcx , Item > for ty:: FieldDef {
1785
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Item {
1786
- clean_field (
1787
- self . did ,
1788
- self . name ,
1789
- clean_middle_ty ( cx. tcx . type_of ( self . did ) , cx, Some ( self . did ) ) ,
1790
- cx,
1791
- )
1792
- }
1782
+ pub ( crate ) fn clean_middle_field < ' tcx > ( field : & ty:: FieldDef , cx : & mut DocContext < ' tcx > ) -> Item {
1783
+ clean_field_with_def_id (
1784
+ field. did ,
1785
+ field. name ,
1786
+ clean_middle_ty ( cx. tcx . type_of ( field. did ) , cx, Some ( field. did ) ) ,
1787
+ cx,
1788
+ )
1793
1789
}
1794
1790
1795
- fn clean_field ( def_id : DefId , name : Symbol , ty : Type , cx : & mut DocContext < ' _ > ) -> Item {
1791
+ pub ( crate ) fn clean_field_with_def_id (
1792
+ def_id : DefId ,
1793
+ name : Symbol ,
1794
+ ty : Type ,
1795
+ cx : & mut DocContext < ' _ > ,
1796
+ ) -> Item {
1796
1797
let what_rustc_thinks =
1797
1798
Item :: from_def_id_and_parts ( def_id, Some ( name) , StructFieldItem ( ty) , cx) ;
1798
1799
if is_field_vis_inherited ( cx. tcx , def_id) {
@@ -1830,27 +1831,27 @@ impl<'tcx> Clean<'tcx, VariantStruct> for rustc_hir::VariantData<'tcx> {
1830
1831
fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> VariantStruct {
1831
1832
VariantStruct {
1832
1833
struct_type : CtorKind :: from_hir ( self ) ,
1833
- fields : self . fields ( ) . iter ( ) . map ( |x| x . clean ( cx) ) . collect ( ) ,
1834
+ fields : self . fields ( ) . iter ( ) . map ( |x| clean_field ( x , cx) ) . collect ( ) ,
1834
1835
}
1835
1836
}
1836
1837
}
1837
1838
1838
1839
impl < ' tcx > Clean < ' tcx , Vec < Item > > for hir:: VariantData < ' tcx > {
1839
1840
fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Vec < Item > {
1840
- self . fields ( ) . iter ( ) . map ( |x| x . clean ( cx) ) . collect ( )
1841
+ self . fields ( ) . iter ( ) . map ( |x| clean_field ( x , cx) ) . collect ( )
1841
1842
}
1842
1843
}
1843
1844
1844
1845
impl < ' tcx > Clean < ' tcx , Item > for ty:: VariantDef {
1845
1846
fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Item {
1846
1847
let kind = match self . ctor_kind {
1847
1848
CtorKind :: Const => Variant :: CLike ,
1848
- CtorKind :: Fn => {
1849
- Variant :: Tuple ( self . fields . iter ( ) . map ( |field| field . clean ( cx) ) . collect ( ) )
1850
- }
1849
+ CtorKind :: Fn => Variant :: Tuple (
1850
+ self . fields . iter ( ) . map ( |field| clean_middle_field ( field , cx) ) . collect ( ) ,
1851
+ ) ,
1851
1852
CtorKind :: Fictive => Variant :: Struct ( VariantStruct {
1852
1853
struct_type : CtorKind :: Fictive ,
1853
- fields : self . fields . iter ( ) . map ( |field| field . clean ( cx) ) . collect ( ) ,
1854
+ fields : self . fields . iter ( ) . map ( |field| clean_middle_field ( field , cx) ) . collect ( ) ,
1854
1855
} ) ,
1855
1856
} ;
1856
1857
let what_rustc_thinks =
@@ -1970,12 +1971,12 @@ fn clean_maybe_renamed_item<'tcx>(
1970
1971
} ) ,
1971
1972
ItemKind :: Union ( ref variant_data, generics) => UnionItem ( Union {
1972
1973
generics : generics. clean ( cx) ,
1973
- fields : variant_data. fields ( ) . iter ( ) . map ( |x| x . clean ( cx) ) . collect ( ) ,
1974
+ fields : variant_data. fields ( ) . iter ( ) . map ( |x| clean_field ( x , cx) ) . collect ( ) ,
1974
1975
} ) ,
1975
1976
ItemKind :: Struct ( ref variant_data, generics) => StructItem ( Struct {
1976
1977
struct_type : CtorKind :: from_hir ( variant_data) ,
1977
1978
generics : generics. clean ( cx) ,
1978
- fields : variant_data. fields ( ) . iter ( ) . map ( |x| x . clean ( cx) ) . collect ( ) ,
1979
+ fields : variant_data. fields ( ) . iter ( ) . map ( |x| clean_field ( x , cx) ) . collect ( ) ,
1979
1980
} ) ,
1980
1981
ItemKind :: Impl ( impl_) => return clean_impl ( impl_, item. hir_id ( ) , cx) ,
1981
1982
// proc macros can have a name set by attributes
0 commit comments