This commit is contained in:
Joshua Warner 2021-06-05 17:09:56 -07:00
parent 18f796a728
commit 9b74dd0c04

View file

@ -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]