Auto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddle
rustdoc: Remove fields_stripped fields (and equivalents) Fixes #90588. r? `@camelid`
This commit is contained in:
commit
222c5724ec
10 changed files with 75 additions and 54 deletions
|
|
@ -2363,8 +2363,7 @@ fn sidebar_enum(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, e: &clean:
|
|||
let mut sidebar = Buffer::new();
|
||||
|
||||
let mut variants = e
|
||||
.variants
|
||||
.iter()
|
||||
.variants()
|
||||
.filter_map(|v| {
|
||||
v.name
|
||||
.as_ref()
|
||||
|
|
|
|||
|
|
@ -1136,6 +1136,7 @@ fn print_tuple_struct_fields(w: &mut Buffer, cx: &Context<'_>, s: &[clean::Item]
|
|||
}
|
||||
|
||||
fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum) {
|
||||
let count_variants = e.variants().count();
|
||||
wrap_into_docblock(w, |w| {
|
||||
wrap_item(w, "enum", |w| {
|
||||
render_attributes_in_pre(w, it, "");
|
||||
|
|
@ -1147,16 +1148,16 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
|
|||
e.generics.print(cx),
|
||||
print_where_clause(&e.generics, cx, 0, true),
|
||||
);
|
||||
if e.variants.is_empty() && !e.variants_stripped {
|
||||
let variants_stripped = e.has_stripped_entries();
|
||||
if count_variants == 0 && !variants_stripped {
|
||||
w.write_str(" {}");
|
||||
} else {
|
||||
w.write_str(" {\n");
|
||||
let count_variants = e.variants.len();
|
||||
let toggle = should_hide_fields(count_variants);
|
||||
if toggle {
|
||||
toggle_open(w, format_args!("{} variants", count_variants));
|
||||
}
|
||||
for v in &e.variants {
|
||||
for v in e.variants() {
|
||||
w.write_str(" ");
|
||||
let name = v.name.unwrap();
|
||||
match *v.kind {
|
||||
|
|
@ -1185,7 +1186,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
|
|||
w.write_str(",\n");
|
||||
}
|
||||
|
||||
if e.variants_stripped {
|
||||
if variants_stripped {
|
||||
w.write_str(" // some variants omitted\n");
|
||||
}
|
||||
if toggle {
|
||||
|
|
@ -1198,7 +1199,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
|
|||
|
||||
document(w, cx, it, None, HeadingOffset::H2);
|
||||
|
||||
if !e.variants.is_empty() {
|
||||
if count_variants != 0 {
|
||||
write!(
|
||||
w,
|
||||
"<h2 id=\"variants\" class=\"variants small-section-header\">\
|
||||
|
|
@ -1206,7 +1207,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
|
|||
document_non_exhaustive_header(it)
|
||||
);
|
||||
document_non_exhaustive(w, it);
|
||||
for variant in &e.variants {
|
||||
for variant in e.variants() {
|
||||
let id = cx.derive_id(format!("{}.{}", ItemType::Variant, variant.name.unwrap()));
|
||||
write!(
|
||||
w,
|
||||
|
|
@ -1650,7 +1651,7 @@ fn render_union(
|
|||
}
|
||||
}
|
||||
|
||||
if it.has_stripped_fields().unwrap() {
|
||||
if it.has_stripped_entries().unwrap() {
|
||||
write!(w, " /* private fields */\n{}", tab);
|
||||
}
|
||||
if toggle {
|
||||
|
|
@ -1706,11 +1707,11 @@ fn render_struct(
|
|||
}
|
||||
|
||||
if has_visible_fields {
|
||||
if it.has_stripped_fields().unwrap() {
|
||||
if it.has_stripped_entries().unwrap() {
|
||||
write!(w, "\n{} /* private fields */", tab);
|
||||
}
|
||||
write!(w, "\n{}", tab);
|
||||
} else if it.has_stripped_fields().unwrap() {
|
||||
} else if it.has_stripped_entries().unwrap() {
|
||||
write!(w, " /* private fields */ ");
|
||||
}
|
||||
if toggle {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue