diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-03-27 10:13:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-27 10:13:44 +0100 |
| commit | c0945f0c9ead2d64c1ce3e149df48f7d4a4bf746 (patch) | |
| tree | 847809d2cfa32d8fe6216502b1625472c014ac70 /src | |
| parent | 64a9360d3f58c16928648aeea57179d2f57f11c9 (diff) | |
| parent | 1942f956a3d8c92fb33d6841b7410e65c33b60dd (diff) | |
| download | rust-c0945f0c9ead2d64c1ce3e149df48f7d4a4bf746.tar.gz rust-c0945f0c9ead2d64c1ce3e149df48f7d4a4bf746.zip | |
Rollup merge of #123116 - chloekek:rustdoc-variant-swap-fields-doc, r=GuillaumeGomez
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. Before:  After: 
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>"); } |
