We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf8d812 commit 1c556bbCopy full SHA for 1c556bb
src/librustdoc/html/render/print_item.rs
@@ -1737,7 +1737,14 @@ fn item_variants(
1737
w.write_str("</h3></section>");
1738
1739
let heading_and_fields = match &variant_data.kind {
1740
- clean::VariantKind::Struct(s) => Some(("Fields", &s.fields)),
+ clean::VariantKind::Struct(s) => {
1741
+ // If there is no field to display, no need to add the heading.
1742
+ if s.fields.iter().any(|f| !f.is_doc_hidden()) {
1743
+ Some(("Fields", &s.fields))
1744
+ } else {
1745
+ None
1746
+ }
1747
1748
clean::VariantKind::Tuple(fields) => {
1749
// Documentation on tuple variant fields is rare, so to reduce noise we only emit
1750
// the section if at least one field is documented.
0 commit comments