aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/handlers/expand_glob_import.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_assists/src/handlers/expand_glob_import.rs b/crates/ra_assists/src/handlers/expand_glob_import.rs
index 978c6772e..69f6b3674 100644
--- a/crates/ra_assists/src/handlers/expand_glob_import.rs
+++ b/crates/ra_assists/src/handlers/expand_glob_import.rs
@@ -147,17 +147,16 @@ fn replace_ast(
147 path: ast::Path, 147 path: ast::Path,
148 used_names: Vec<Name>, 148 used_names: Vec<Name>,
149) { 149) {
150 let replacement: Either<ast::UseTree, ast::UseTreeList> = if used_names.len() == 1 { 150 let replacement: Either<ast::UseTree, ast::UseTreeList> = match used_names.as_slice() {
151 Either::Left(ast::make::use_tree( 151 [name] => Either::Left(ast::make::use_tree(
152 ast::make::path_from_text(&format!("{}::{}", path, used_names.first().unwrap())), 152 ast::make::path_from_text(&format!("{}::{}", path, name)),
153 None, 153 None,
154 None, 154 None,
155 false, 155 false,
156 )) 156 )),
157 } else { 157 names => Either::Right(ast::make::use_tree_list(names.iter().map(|n| {
158 Either::Right(ast::make::use_tree_list(used_names.iter().map(|n| {
159 ast::make::use_tree(ast::make::path_from_text(&n.to_string()), None, None, false) 158 ast::make::use_tree(ast::make::path_from_text(&n.to_string()), None, None, false)
160 }))) 159 }))),
161 }; 160 };
162 161
163 let mut replace_node = |replacement: Either<ast::UseTree, ast::UseTreeList>| { 162 let mut replace_node = |replacement: Either<ast::UseTree, ast::UseTreeList>| {