mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
fmt
This commit is contained in:
parent
18f796a728
commit
9b74dd0c04
1 changed files with 12 additions and 3 deletions
|
@ -97,10 +97,16 @@ fn edit_struct_def(
|
||||||
if let Either::Left(strukt) = strukt {
|
if let Either::Left(strukt) = strukt {
|
||||||
if let Some(w) = strukt.where_clause() {
|
if let Some(w) = strukt.where_clause() {
|
||||||
edit.delete(w.syntax().text_range());
|
edit.delete(w.syntax().text_range());
|
||||||
edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_newline().text());
|
edit.insert(
|
||||||
|
tuple_fields_text_range.start(),
|
||||||
|
ast::make::tokens::single_newline().text(),
|
||||||
|
);
|
||||||
edit.insert(tuple_fields_text_range.start(), w.syntax().text());
|
edit.insert(tuple_fields_text_range.start(), w.syntax().text());
|
||||||
edit.insert(tuple_fields_text_range.start(), ",");
|
edit.insert(tuple_fields_text_range.start(), ",");
|
||||||
edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_newline().text());
|
edit.insert(
|
||||||
|
tuple_fields_text_range.start(),
|
||||||
|
ast::make::tokens::single_newline().text(),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_space().text());
|
edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_space().text());
|
||||||
}
|
}
|
||||||
|
@ -534,7 +540,10 @@ where
|
||||||
convert_tuple_struct_to_named_struct,
|
convert_tuple_struct_to_named_struct,
|
||||||
r#"enum Enum { Variant$0 { value: usize } };"#,
|
r#"enum Enum { Variant$0 { value: usize } };"#,
|
||||||
);
|
);
|
||||||
check_assist_not_applicable(convert_tuple_struct_to_named_struct, r#"enum Enum { Variant$0 }"#);
|
check_assist_not_applicable(
|
||||||
|
convert_tuple_struct_to_named_struct,
|
||||||
|
r#"enum Enum { Variant$0 }"#,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue