Skip to content

Commit

Permalink
Use Item::from_def_id for StructField
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Nov 26, 2020
1 parent 65ecc48 commit f8b3a28
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -1844,15 +1844,13 @@ impl Clean<Item> for ty::VariantDef {
fields: self
.fields
.iter()
.map(|field| Item {
source: cx.tcx.def_span(field.did).clean(cx),
name: Some(field.ident.name.clean(cx)),
attrs: cx.tcx.get_attrs(field.did).clean(cx),
visibility: Visibility::Inherited,
def_id: field.did,
stability: get_stability(cx, field.did),
deprecation: get_deprecation(cx, field.did),
kind: StructFieldItem(cx.tcx.type_of(field.did).clean(cx)),
.map(|field| {
let name = Some(field.ident.name);
let kind = StructFieldItem(cx.tcx.type_of(field.did).clean(cx));
let what_rustc_thinks =
Item::from_def_id_and_parts(field.did, name, kind, cx);
// don't show `pub` for fields, which are always public
Item { visibility: Visibility::Inherited, ..what_rustc_thinks }
})
.collect(),
}),
Expand Down

0 comments on commit f8b3a28

Please sign in to comment.