mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
fix: remove space within {}
when no fields in struct
This commit is contained in:
parent
43576989a1
commit
aa1f1344cc
2 changed files with 35 additions and 11 deletions
|
@ -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(',')?;
|
||||
|
||||
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)?;
|
||||
}
|
||||
}
|
||||
|
||||
if fields.len() > count {
|
||||
f.write_str(indent)?;
|
||||
f.write_str("/* … */")?;
|
||||
f.write_char(separator)?;
|
||||
}
|
||||
f.write_str("}")?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue