diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-11-23 22:03:37 -0500 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-11-26 14:13:55 -0500 |
| commit | f8b3a28e9c85b3b0aeb77ccfdd7901b7e9ed6d7d (patch) | |
| tree | 2829d9def78b58ee06b997ae5b750d37411432a8 | |
| parent | 65ecc481fac7ceced57d973a580d0a7ccbdcb192 (diff) | |
| download | rust-f8b3a28e9c85b3b0aeb77ccfdd7901b7e9ed6d7d.tar.gz rust-f8b3a28e9c85b3b0aeb77ccfdd7901b7e9ed6d7d.zip | |
Use `Item::from_def_id` for StructField
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index ea34085823f..b50f325c074 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -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(), }), |
