Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c0945f0

Browse files
Rollup merge of rust-lang#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: ![Screenshot of rendered documentation before this patch.](https://github.com/rust-lang/rust/assets/50083900/4c98258e-bdf7-4507-9cf1-fe601407ff11) After: ![Screenshot of rendered documentation after this patch.](https://github.com/rust-lang/rust/assets/50083900/bd223f92-9b06-4b5a-820e-7a8501bdc0e2)
2 parents 64a9360 + 1942f95 commit c0945f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/librustdoc/html/render/print_item.rs‎

Lines changed: 2 additions & 2 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /