fix: don't add extra whitespace around fields

closes #8785
This commit is contained in:
Aleksey Kladov 2021-05-17 12:41:48 +03:00
parent 21918c6f5e
commit 75a0123614
2 changed files with 29 additions and 0 deletions

View file

@ -186,6 +186,31 @@ fn test_fn() {
let one = 1; let one = 1;
let s = TestStruct{ ..a }; let s = TestStruct{ ..a };
} }
"#,
);
}
#[test]
fn test_fill_struct_fields_blank_line() {
check_fix(
r#"
struct S { a: (), b: () }
fn f() {
S {
$0
};
}
"#,
r#"
struct S { a: (), b: () }
fn f() {
S {
a: (),
b: (),
};
}
"#, "#,
); );
} }

View file

@ -378,6 +378,10 @@ impl ast::RecordExprFieldList {
make::tokens::single_space() make::tokens::single_space()
}; };
if is_multiline {
normalize_ws_between_braces(self.syntax());
}
let position = match self.fields().last() { let position = match self.fields().last() {
Some(last_field) => { Some(last_field) => {
let comma = match last_field let comma = match last_field