fix: remove space within {}
when no fields in struct
This commit is contained in:
parent
0e9d845fc7
commit
f7f02c0d12
@ -249,6 +249,8 @@ fn display_fields(
|
||||
}
|
||||
} else {
|
||||
f.write_char('{')?;
|
||||
|
||||
if !fields.is_empty() {
|
||||
f.write_char(separator)?;
|
||||
for field in &fields[..count] {
|
||||
f.write_str(indent)?;
|
||||
@ -262,6 +264,8 @@ fn display_fields(
|
||||
f.write_str("/* … */")?;
|
||||
f.write_char(separator)?;
|
||||
}
|
||||
}
|
||||
|
||||
f.write_str("}")?;
|
||||
}
|
||||
|
||||
|
@ -1039,7 +1039,27 @@ fn hover_record_struct_limit() {
|
||||
struct Foo { /* … */ }
|
||||
```
|
||||
"#]],
|
||||
)
|
||||
);
|
||||
|
||||
// No extra spaces within `{}` when there are no fields
|
||||
check_hover_fields_limit(
|
||||
5,
|
||||
r#"
|
||||
struct Foo$0 {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
*Foo*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
// size = 0, align = 1
|
||||
struct Foo {}
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user