aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_assists')
-rw-r--r--crates/ide_assists/src/handlers/expand_glob_import.rs4
-rw-r--r--crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs7
2 files changed, 4 insertions, 7 deletions
diff --git a/crates/ide_assists/src/handlers/expand_glob_import.rs b/crates/ide_assists/src/handlers/expand_glob_import.rs
index 5b540df5c..83aa11d52 100644
--- a/crates/ide_assists/src/handlers/expand_glob_import.rs
+++ b/crates/ide_assists/src/handlers/expand_glob_import.rs
@@ -73,8 +73,8 @@ fn find_parent_and_path(
73) -> Option<(Either<ast::UseTree, ast::UseTreeList>, ast::Path)> { 73) -> Option<(Either<ast::UseTree, ast::UseTreeList>, ast::Path)> {
74 return star.ancestors().find_map(|n| { 74 return star.ancestors().find_map(|n| {
75 find_use_tree_list(n.clone()) 75 find_use_tree_list(n.clone())
76 .and_then(|(u, p)| Some((Either::Right(u), p))) 76 .map(|(u, p)| (Either::Right(u), p))
77 .or_else(|| find_use_tree(n).and_then(|(u, p)| Some((Either::Left(u), p)))) 77 .or_else(|| find_use_tree(n).map(|(u, p)| (Either::Left(u), p)))
78 }); 78 });
79 79
80 fn find_use_tree_list(n: SyntaxNode) -> Option<(ast::UseTreeList, ast::Path)> { 80 fn find_use_tree_list(n: SyntaxNode) -> Option<(ast::UseTreeList, ast::Path)> {
diff --git a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
index 335e0ed95..596c536a7 100644
--- a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -145,11 +145,8 @@ fn insert_import(
145 variant_hir_name: &Name, 145 variant_hir_name: &Name,
146) -> Option<()> { 146) -> Option<()> {
147 let db = ctx.db(); 147 let db = ctx.db();
148 let mod_path = module.find_use_path_prefixed( 148 let mod_path =
149 db, 149 module.find_use_path_prefixed(db, *enum_module_def, ctx.config.insert_use.prefix_kind);
150 enum_module_def.clone(),
151 ctx.config.insert_use.prefix_kind,
152 );
153 if let Some(mut mod_path) = mod_path { 150 if let Some(mut mod_path) = mod_path {
154 mod_path.pop_segment(); 151 mod_path.pop_segment();
155 mod_path.push_segment(variant_hir_name.clone()); 152 mod_path.push_segment(variant_hir_name.clone());