diff options
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r-- | crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs | 13 |
1 files changed, 9 insertions, 4 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 2b1951aff..72e5dd735 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 | |||
@@ -9,11 +9,11 @@ use ra_syntax::{ | |||
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
11 | assist_context::{AssistBuilder, AssistDirector}, | 11 | assist_context::{AssistBuilder, AssistDirector}, |
12 | utils::insert_use_statement, | 12 | utils::insert_use::insert_use_statement_with_string_path, |
13 | AssistContext, AssistId, Assists, | 13 | AssistContext, AssistId, Assists, |
14 | }; | 14 | }; |
15 | use ast::{ArgListOwner, VisibilityOwner}; | 15 | use ast::{ArgListOwner, VisibilityOwner}; |
16 | use hir::{AsName, EnumVariant, Module, ModuleDef}; | 16 | use hir::{EnumVariant, Module, ModuleDef}; |
17 | use ra_db::FileId; | 17 | use ra_db::FileId; |
18 | use ra_fmt::leading_indent; | 18 | use ra_fmt::leading_indent; |
19 | use rustc_hash::FxHashSet; | 19 | use rustc_hash::FxHashSet; |
@@ -109,8 +109,13 @@ fn insert_import( | |||
109 | let mod_path = module.find_use_path(db, module_def.clone()); | 109 | let mod_path = module.find_use_path(db, module_def.clone()); |
110 | if let Some(mut mod_path) = mod_path { | 110 | if let Some(mut mod_path) = mod_path { |
111 | mod_path.segments.pop(); | 111 | mod_path.segments.pop(); |
112 | mod_path.segments.push(path_segment.as_name()); | 112 | let use_path = format!("{}::{}", mod_path.to_string(), path_segment.to_string()); |
113 | insert_use_statement(path.syntax(), &mod_path, ctx, builder.text_edit_builder()); | 113 | insert_use_statement_with_string_path( |
114 | path.syntax(), | ||
115 | &use_path, | ||
116 | ctx, | ||
117 | builder.text_edit_builder(), | ||
118 | ); | ||
114 | } | 119 | } |
115 | Some(()) | 120 | Some(()) |
116 | } | 121 | } |