Don't print "private fields" on empty tuple structs
Test for presence rather than absence Remove redundant tests Issues in those parts will likely be caught by other parts of the test suite.
This commit is contained in:
parent
1e9dda77b5
commit
a21d7713db
2 changed files with 18 additions and 5 deletions
|
|
@ -1501,8 +1501,10 @@ fn print_tuple_struct_fields<'a, 'cx: 'a>(
|
|||
s: &'a [clean::Item],
|
||||
) -> impl fmt::Display + 'a + Captures<'cx> {
|
||||
display_fn(|f| {
|
||||
if s.iter()
|
||||
.all(|field| matches!(*field.kind, clean::StrippedItem(box clean::StructFieldItem(..))))
|
||||
if !s.is_empty()
|
||||
&& s.iter().all(|field| {
|
||||
matches!(*field.kind, clean::StrippedItem(box clean::StructFieldItem(..)))
|
||||
})
|
||||
{
|
||||
return f.write_str("/* private fields */");
|
||||
}
|
||||
|
|
@ -2275,9 +2277,11 @@ fn render_struct_fields(
|
|||
}
|
||||
Some(CtorKind::Fn) => {
|
||||
w.write_str("(");
|
||||
if fields.iter().all(|field| {
|
||||
matches!(*field.kind, clean::StrippedItem(box clean::StructFieldItem(..)))
|
||||
}) {
|
||||
if !fields.is_empty()
|
||||
&& fields.iter().all(|field| {
|
||||
matches!(*field.kind, clean::StrippedItem(box clean::StructFieldItem(..)))
|
||||
})
|
||||
{
|
||||
write!(w, "/* private fields */");
|
||||
} else {
|
||||
for (i, field) in fields.iter().enumerate() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue