Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/display.rs')
| -rw-r--r-- | crates/hir/src/display.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index 1c3eac1590..c276e87786 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs @@ -249,19 +249,23 @@ fn display_fields( } } else { f.write_char('{')?; - f.write_char(separator)?; - for field in &fields[..count] { - f.write_str(indent)?; - field.hir_fmt(f)?; - f.write_char(',')?; - f.write_char(separator)?; - } - if fields.len() > count { - f.write_str(indent)?; - f.write_str("/* … */")?; + if !fields.is_empty() { f.write_char(separator)?; + for field in &fields[..count] { + f.write_str(indent)?; + field.hir_fmt(f)?; + f.write_char(',')?; + f.write_char(separator)?; + } + + if fields.len() > count { + f.write_str(indent)?; + f.write_str("/* … */")?; + f.write_char(separator)?; + } } + f.write_str("}")?; } |