@@ -122,7 +122,7 @@ impl Clean<ExternalCrate> for CrateNum {
122122 }
123123 }
124124 }
125- return prim. map ( |p| ( def_id, p, attrs ) ) ;
125+ return prim. map ( |p| ( def_id, p) ) ;
126126 }
127127 None
128128 } ;
@@ -144,9 +144,9 @@ impl Clean<ExternalCrate> for CrateNum {
144144 hir:: ItemKind :: Use ( ref path, hir:: UseKind :: Single )
145145 if item. vis . node . is_pub ( ) =>
146146 {
147- as_primitive ( path. res ) . map ( |( _, prim, attrs ) | {
147+ as_primitive ( path. res ) . map ( |( _, prim) | {
148148 // Pretend the primitive is local.
149- ( cx. tcx . hir ( ) . local_def_id ( id. id ) . to_def_id ( ) , prim, attrs )
149+ ( cx. tcx . hir ( ) . local_def_id ( id. id ) . to_def_id ( ) , prim)
150150 } )
151151 }
152152 _ => None ,
@@ -177,7 +177,7 @@ impl Clean<ExternalCrate> for CrateNum {
177177 }
178178 }
179179 }
180- return keyword. map ( |p| ( def_id, p, attrs ) ) ;
180+ return keyword. map ( |p| ( def_id, p) ) ;
181181 }
182182 None
183183 } ;
@@ -199,8 +199,8 @@ impl Clean<ExternalCrate> for CrateNum {
199199 hir:: ItemKind :: Use ( ref path, hir:: UseKind :: Single )
200200 if item. vis . node . is_pub ( ) =>
201201 {
202- as_keyword ( path. res ) . map ( |( _, prim, attrs ) | {
203- ( cx. tcx . hir ( ) . local_def_id ( id. id ) . to_def_id ( ) , prim, attrs )
202+ as_keyword ( path. res ) . map ( |( _, prim) | {
203+ ( cx. tcx . hir ( ) . local_def_id ( id. id ) . to_def_id ( ) , prim)
204204 } )
205205 }
206206 _ => None ,
@@ -1099,7 +1099,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
10991099 AssocTypeItem ( bounds. clean ( cx) , default. clean ( cx) )
11001100 }
11011101 } ;
1102- Item :: from_def_id_and_parts ( local_did, Some ( self . ident . name ) , inner, cx)
1102+ Item :: from_def_id_and_parts ( local_did, Some ( self . ident . name . clean ( cx ) ) , inner, cx)
11031103 } )
11041104 }
11051105}
@@ -1127,7 +1127,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
11271127 TypedefItem ( Typedef { type_, generics : Generics :: default ( ) , item_type } , true )
11281128 }
11291129 } ;
1130- Item :: from_def_id_and_parts ( local_did, Some ( self . ident . name ) , inner, cx)
1130+ Item :: from_def_id_and_parts ( local_did, Some ( self . ident . name . clean ( cx ) ) , inner, cx)
11311131 } )
11321132 }
11331133}
@@ -1284,7 +1284,7 @@ impl Clean<Item> for ty::AssocItem {
12841284 }
12851285 } ;
12861286
1287- Item :: from_def_id_and_parts ( self . def_id , Some ( self . ident . name ) , kind, cx)
1287+ Item :: from_def_id_and_parts ( self . def_id , Some ( self . ident . name . clean ( cx ) ) , kind, cx)
12881288 }
12891289}
12901290
@@ -1769,7 +1769,7 @@ impl Clean<Item> for ty::FieldDef {
17691769 fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
17701770 let what_rustc_thinks = Item :: from_def_id_and_parts (
17711771 self . did ,
1772- Some ( self . ident . name ) ,
1772+ Some ( self . ident . name . clean ( cx ) ) ,
17731773 StructFieldItem ( cx. tcx . type_of ( self . did ) . clean ( cx) ) ,
17741774 cx,
17751775 ) ;
@@ -1844,22 +1844,20 @@ impl Clean<Item> for ty::VariantDef {
18441844 fields : self
18451845 . fields
18461846 . iter ( )
1847- . map ( |field| Item {
1848- source : cx. tcx . def_span ( field. did ) . clean ( cx) ,
1849- name : Some ( field. ident . name . clean ( cx) ) ,
1850- attrs : cx. tcx . get_attrs ( field. did ) . clean ( cx) ,
1851- visibility : Visibility :: Inherited ,
1852- def_id : field. did ,
1853- stability : get_stability ( cx, field. did ) ,
1854- deprecation : get_deprecation ( cx, field. did ) ,
1855- kind : StructFieldItem ( cx. tcx . type_of ( field. did ) . clean ( cx) ) ,
1847+ . map ( |field| {
1848+ let name = Some ( field. ident . name . clean ( cx) ) ;
1849+ let kind = StructFieldItem ( cx. tcx . type_of ( field. did ) . clean ( cx) ) ;
1850+ let what_rustc_thinks =
1851+ Item :: from_def_id_and_parts ( field. did , name, kind, cx) ;
1852+ // don't show `pub` for fields, which are always public
1853+ Item { visibility : Visibility :: Inherited , ..what_rustc_thinks }
18561854 } )
18571855 . collect ( ) ,
18581856 } ) ,
18591857 } ;
18601858 let what_rustc_thinks = Item :: from_def_id_and_parts (
18611859 self . def_id ,
1862- Some ( self . ident . name ) ,
1860+ Some ( self . ident . name . clean ( cx ) ) ,
18631861 VariantItem ( Variant { kind } ) ,
18641862 cx,
18651863 ) ;
@@ -2057,7 +2055,7 @@ impl Clean<Vec<Item>> for (&hir::Item<'_>, Option<Ident>) {
20572055 _ => unreachable ! ( "not yet converted" ) ,
20582056 } ;
20592057
2060- vec ! [ Item :: from_def_id_and_parts( def_id, Some ( name) , kind, cx) ]
2058+ vec ! [ Item :: from_def_id_and_parts( def_id, Some ( name. clean ( cx ) ) , kind, cx) ]
20612059 } )
20622060 }
20632061}
@@ -2319,7 +2317,7 @@ impl Clean<Item> for doctree::Macro {
23192317 fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
23202318 Item :: from_def_id_and_parts (
23212319 self . def_id ,
2322- Some ( self . name ) ,
2320+ Some ( self . name . clean ( cx ) ) ,
23232321 MacroItem ( Macro {
23242322 source : format ! (
23252323 "macro_rules! {} {{\n {}}}" ,
0 commit comments