Skip to content

Commit f8b3a28

Browse files
committed
Use Item::from_def_id for StructField
1 parent 65ecc48 commit f8b3a28

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/librustdoc/clean/mod.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -1844,15 +1844,13 @@ 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);
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
}),

0 commit comments

Comments
 (0)