Skip to content

Commit 1942f95

Browse files
author
chloekek
committed
rustdoc: Swap fields and variant documentations
Previously, the documentation for a variant appeared after the documentation for each of its fields. This was inconsistent with structs and unions, and made little sense on its own; fields are subordinate to variants and should therefore appear later in the documentation.
1 parent 47ecded commit 1942f95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/html/render/print_item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,8 @@ fn item_variants(
17281728
}
17291729
w.write_str("</h3></section>");
17301730

1731+
write!(w, "{}", document(cx, variant, Some(it), HeadingOffset::H4));
1732+
17311733
let heading_and_fields = match &variant_data.kind {
17321734
clean::VariantKind::Struct(s) => {
17331735
// If there is no field to display, no need to add the heading.
@@ -1789,8 +1791,6 @@ fn item_variants(
17891791
}
17901792
w.write_str("</div>");
17911793
}
1792-
1793-
write!(w, "{}", document(cx, variant, Some(it), HeadingOffset::H4));
17941794
}
17951795
write!(w, "</div>");
17961796
}

0 commit comments

Comments
 (0)