diff options
| author | chloekek <chloekek@use.startmail.com> | 2024-03-27 01:17:33 +0100 |
|---|---|---|
| committer | chloekek <chloekek@use.startmail.com> | 2024-03-27 01:23:48 +0100 |
| commit | 1942f956a3d8c92fb33d6841b7410e65c33b60dd (patch) | |
| tree | 2d0d570f60d1a2026ff149059f7f93820b4d6627 /src | |
| parent | 47ecded3525392b77843534bed69b4302f9af8d2 (diff) | |
| download | rust-1942f956a3d8c92fb33d6841b7410e65c33b60dd.tar.gz rust-1942f956a3d8c92fb33d6841b7410e65c33b60dd.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 5d4f1acc4b1..fbb521a6188 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1728,6 +1728,8 @@ fn item_variants( } w.write_str("</h3></section>"); + write!(w, "{}", document(cx, variant, Some(it), HeadingOffset::H4)); + let heading_and_fields = match &variant_data.kind { clean::VariantKind::Struct(s) => { // If there is no field to display, no need to add the heading. @@ -1789,8 +1791,6 @@ fn item_variants( } w.write_str("</div>"); } - - write!(w, "{}", document(cx, variant, Some(it), HeadingOffset::H4)); } write!(w, "</div>"); } |
