Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ fn item_typedef(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clea
fn item_union(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean::Union) {
wrap_item(w, |w| {
render_attributes_in_pre(w, it, "");
render_union(w, it, Some(&s.generics), &s.fields, "", cx);
render_union(w, it, Some(&s.generics), &s.fields, cx);
});

document(w, cx, it, None, HeadingOffset::H2);
Expand Down Expand Up @@ -1628,7 +1628,6 @@ fn render_union(
it: &clean::Item,
g: Option<&clean::Generics>,
fields: &[clean::Item],
tab: &str,
cx: &Context<'_>,
) {
let tcx = cx.tcx();
Expand All @@ -1651,7 +1650,7 @@ fn render_union(
w.write_str(" ");
}

write!(w, "{{\n{}", tab);
write!(w, "{{\n");
let count_fields =
fields.iter().filter(|f| matches!(*f.kind, clean::StructFieldItem(..))).count();
let toggle = should_hide_fields(count_fields);
Expand All @@ -1663,17 +1662,16 @@ fn render_union(
if let clean::StructFieldItem(ref ty) = *field.kind {
write!(
w,
" {}{}: {},\n{}",
" {}{}: {},\n",
visibility_print_with_space(field.visibility(tcx), field.item_id, cx),
field.name.unwrap(),
ty.print(cx),
tab
ty.print(cx)
);
}
}

if it.has_stripped_entries().unwrap() {
write!(w, " /* private fields */\n{}", tab);
write!(w, " /* private fields */\n");
}
if toggle {
toggle_close(w);
Expand Down