diff options
author | Aleksey Kladov <[email protected]> | 2020-08-13 10:56:11 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-13 10:59:42 +0100 |
commit | c81f6230da98fd3e3fa91c0896d65922a1ed4a24 (patch) | |
tree | e355901a2d197f2b7cceb35a732a111afed58198 /crates/ra_assists/src/handlers | |
parent | 479235ff0b25dbac977d28475b9203e3207b117b (diff) |
Remove ra_fmt crate
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r-- | crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs index b4e19b3dc..497f887cd 100644 --- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -1,11 +1,10 @@ | |||
1 | use hir::{EnumVariant, Module, ModuleDef, Name}; | 1 | use hir::{EnumVariant, Module, ModuleDef, Name}; |
2 | use ra_db::FileId; | 2 | use ra_db::FileId; |
3 | use ra_fmt::leading_indent; | ||
4 | use ra_ide_db::{defs::Definition, search::Reference, RootDatabase}; | 3 | use ra_ide_db::{defs::Definition, search::Reference, RootDatabase}; |
5 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
6 | use syntax::{ | 5 | use syntax::{ |
7 | algo::find_node_at_offset, | 6 | algo::find_node_at_offset, |
8 | ast::{self, ArgListOwner, AstNode, NameOwner, VisibilityOwner}, | 7 | ast::{self, edit::IndentLevel, ArgListOwner, AstNode, NameOwner, VisibilityOwner}, |
9 | SourceFile, TextRange, TextSize, | 8 | SourceFile, TextRange, TextSize, |
10 | }; | 9 | }; |
11 | 10 | ||
@@ -112,7 +111,7 @@ fn insert_import( | |||
112 | Some(()) | 111 | Some(()) |
113 | } | 112 | } |
114 | 113 | ||
115 | // FIXME: this should use strongly-typed `make`, rather than string manipulation1 | 114 | // FIXME: this should use strongly-typed `make`, rather than string manipulation. |
116 | fn extract_struct_def( | 115 | fn extract_struct_def( |
117 | builder: &mut AssistBuilder, | 116 | builder: &mut AssistBuilder, |
118 | enum_: &ast::Enum, | 117 | enum_: &ast::Enum, |
@@ -127,11 +126,7 @@ fn extract_struct_def( | |||
127 | } else { | 126 | } else { |
128 | "".to_string() | 127 | "".to_string() |
129 | }; | 128 | }; |
130 | let indent = if let Some(indent) = leading_indent(enum_.syntax()) { | 129 | let indent = IndentLevel::from_node(enum_.syntax()); |
131 | indent.to_string() | ||
132 | } else { | ||
133 | "".to_string() | ||
134 | }; | ||
135 | let struct_def = format!( | 130 | let struct_def = format!( |
136 | r#"{}struct {}{}; | 131 | r#"{}struct {}{}; |
137 | 132 | ||