Skip to content

Commit 60880af

Browse files
committed
rustdoc: Don't show a fields header if there are none
1 parent 5948079 commit 60880af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustdoc/html/render.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ impl DocFolder for Cache {
461461
let orig_privmod = match item.inner {
462462
clean::ModuleItem(..) => {
463463
let prev = self.privmod;
464-
self.privmod = prev || item.visibility != Some(ast::public);
464+
self.privmod = prev || item.visibility != Some(ast::Public);
465465
prev
466466
}
467467
_ => self.privmod,
@@ -628,7 +628,7 @@ impl DocFolder for Cache {
628628
visibility, .. }
629629
if (m.items.len() == 0 &&
630630
item.doc_value().is_none()) ||
631-
visibility != Some(ast::public) => None,
631+
visibility != Some(ast::Public) => None,
632632

633633
i => Some(i),
634634
}
@@ -1203,7 +1203,7 @@ fn item_struct(w: &mut Writer, it: &clean::Item, s: &clean::Struct) {
12031203

12041204
document(w, it);
12051205
match s.struct_type {
1206-
doctree::Plain => {
1206+
doctree::Plain if s.fields.len() > 0 => {
12071207
write!(w, "<h2 class='fields'>Fields</h2>\n<table>");
12081208
for field in s.fields.iter() {
12091209
write!(w, "<tr><td id='structfield.{name}'>\

0 commit comments

Comments
 (0)