aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src
diff options
context:
space:
mode:
authorJoshua Warner <[email protected]>2021-06-06 01:09:56 +0100
committerJoshua Warner <[email protected]>2021-06-06 01:09:56 +0100
commit9b74dd0c04651eb22e743c6ffc91c11bb3df87d8 (patch)
treebd4b44f8e3477b4f1c9ac7d5edf40eeec53573b8 /crates/ide_assists/src
parent18f796a728806e5138708a7af00d6064ec251382 (diff)
fmt
Diffstat (limited to 'crates/ide_assists/src')
-rw-r--r--crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs b/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs
index 53709e31f..fc5a17f05 100644
--- a/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs
+++ b/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs
@@ -97,10 +97,16 @@ fn edit_struct_def(
97 if let Either::Left(strukt) = strukt { 97 if let Either::Left(strukt) = strukt {
98 if let Some(w) = strukt.where_clause() { 98 if let Some(w) = strukt.where_clause() {
99 edit.delete(w.syntax().text_range()); 99 edit.delete(w.syntax().text_range());
100 edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_newline().text()); 100 edit.insert(
101 tuple_fields_text_range.start(),
102 ast::make::tokens::single_newline().text(),
103 );
101 edit.insert(tuple_fields_text_range.start(), w.syntax().text()); 104 edit.insert(tuple_fields_text_range.start(), w.syntax().text());
102 edit.insert(tuple_fields_text_range.start(), ","); 105 edit.insert(tuple_fields_text_range.start(), ",");
103 edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_newline().text()); 106 edit.insert(
107 tuple_fields_text_range.start(),
108 ast::make::tokens::single_newline().text(),
109 );
104 } else { 110 } else {
105 edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_space().text()); 111 edit.insert(tuple_fields_text_range.start(), ast::make::tokens::single_space().text());
106 } 112 }
@@ -534,7 +540,10 @@ where
534 convert_tuple_struct_to_named_struct, 540 convert_tuple_struct_to_named_struct,
535 r#"enum Enum { Variant$0 { value: usize } };"#, 541 r#"enum Enum { Variant$0 { value: usize } };"#,
536 ); 542 );
537 check_assist_not_applicable(convert_tuple_struct_to_named_struct, r#"enum Enum { Variant$0 }"#); 543 check_assist_not_applicable(
544 convert_tuple_struct_to_named_struct,
545 r#"enum Enum { Variant$0 }"#,
546 );
538 } 547 }
539 548
540 #[test] 549 #[test]