aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/expand_glob_import.rs21
1 files changed, 1 insertions, 20 deletions
diff --git a/crates/ra_assists/src/handlers/expand_glob_import.rs b/crates/ra_assists/src/handlers/expand_glob_import.rs
index 963c1353f..1eb8070ad 100644
--- a/crates/ra_assists/src/handlers/expand_glob_import.rs
+++ b/crates/ra_assists/src/handlers/expand_glob_import.rs
@@ -59,26 +59,7 @@ pub(crate) fn expand_glob_import(acc: &mut Assists, ctx: &AssistContext) -> Opti
59} 59}
60 60
61fn find_mod_path(star: &SyntaxToken) -> Option<ast::Path> { 61fn find_mod_path(star: &SyntaxToken) -> Option<ast::Path> {
62 let mut node = star.parent(); 62 star.ancestors().find_map(|n| ast::UseTree::cast(n).and_then(|u| u.path()))
63
64 loop {
65 match_ast! {
66 match node {
67 ast::UseTree(use_tree) => {
68 if let Some(path) = use_tree.path() {
69 return Some(path);
70 }
71 },
72 ast::UseTreeList(_use_tree_list) => {},
73 _ => return None,
74 }
75 }
76
77 node = match node.parent() {
78 Some(node) => node,
79 None => return None,
80 }
81 }
82} 63}
83 64
84#[derive(PartialEq)] 65#[derive(PartialEq)]