aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assists/src/handlers/extract_struct_from_enum_variant.rs')
-rw-r--r--crates/assists/src/handlers/extract_struct_from_enum_variant.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
index 3ea50f375..d1eadaa99 100644
--- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -12,7 +12,6 @@ use syntax::{
12use crate::{ 12use crate::{
13 assist_context::AssistBuilder, utils::insert_use, AssistContext, AssistId, AssistKind, Assists, 13 assist_context::AssistBuilder, utils::insert_use, AssistContext, AssistId, AssistKind, Assists,
14}; 14};
15use ast::make;
16use insert_use::ImportScope; 15use insert_use::ImportScope;
17 16
18// Assist: extract_struct_from_enum_variant 17// Assist: extract_struct_from_enum_variant
@@ -112,11 +111,7 @@ fn insert_import(
112 let scope = ImportScope::find_insert_use_container(path.syntax(), ctx)?; 111 let scope = ImportScope::find_insert_use_container(path.syntax(), ctx)?;
113 let syntax = scope.as_syntax_node(); 112 let syntax = scope.as_syntax_node();
114 113
115 let new_syntax = insert_use( 114 let new_syntax = insert_use(&scope, mod_path.to_ast_path(), ctx.config.insert_use.merge);
116 &scope,
117 make::path_from_text(&mod_path.to_string()),
118 ctx.config.insert_use.merge,
119 );
120 // FIXME: this will currently panic as multiple imports will have overlapping text ranges 115 // FIXME: this will currently panic as multiple imports will have overlapping text ranges
121 builder.replace(syntax.text_range(), new_syntax.to_string()) 116 builder.replace(syntax.text_range(), new_syntax.to_string())
122 } 117 }