aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/path/lower
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/path/lower')
-rw-r--r--crates/ra_hir_def/src/path/lower/lower_use.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/path/lower/lower_use.rs b/crates/ra_hir_def/src/path/lower/lower_use.rs
index f693cefbc..d2bc9d193 100644
--- a/crates/ra_hir_def/src/path/lower/lower_use.rs
+++ b/crates/ra_hir_def/src/path/lower/lower_use.rs
@@ -8,14 +8,13 @@ use hir_expand::{hygiene::Hygiene, name::AsName};
8use ra_syntax::ast::{self, NameOwner}; 8use ra_syntax::ast::{self, NameOwner};
9use test_utils::tested_by; 9use test_utils::tested_by;
10 10
11use crate::nameres::raw::ImportAlias; 11use crate::path::{ImportAlias, ModPath, PathKind};
12use crate::path::{ModPath, PathKind};
13 12
14pub(crate) fn lower_use_tree( 13pub(crate) fn lower_use_tree(
15 prefix: Option<ModPath>, 14 prefix: Option<ModPath>,
16 tree: ast::UseTree, 15 tree: ast::UseTree,
17 hygiene: &Hygiene, 16 hygiene: &Hygiene,
18 cb: &mut dyn FnMut(ModPath, &ast::UseTree, bool, ImportAlias), 17 cb: &mut dyn FnMut(ModPath, &ast::UseTree, bool, Option<ImportAlias>),
19) { 18) {
20 if let Some(use_tree_list) = tree.use_tree_list() { 19 if let Some(use_tree_list) = tree.use_tree_list() {
21 let prefix = match tree.path() { 20 let prefix = match tree.path() {
@@ -32,8 +31,10 @@ pub(crate) fn lower_use_tree(
32 lower_use_tree(prefix.clone(), child_tree, hygiene, cb); 31 lower_use_tree(prefix.clone(), child_tree, hygiene, cb);
33 } 32 }
34 } else { 33 } else {
35 let alias = tree.alias().map_or(ImportAlias::NoAlias, |a| { 34 let alias = tree.alias().map(|a| {
36 a.name().map(|it| it.as_name()).map_or(ImportAlias::Unnamed, |a| ImportAlias::Alias(a)) 35 a.name()
36 .map(|it| it.as_name())
37 .map_or(ImportAlias::Underscore, |a| ImportAlias::Alias(a))
37 }); 38 });
38 let is_glob = tree.has_star(); 39 let is_glob = tree.has_star();
39 if let Some(ast_path) = tree.path() { 40 if let Some(ast_path) = tree.path() {
@@ -57,7 +58,7 @@ pub(crate) fn lower_use_tree(
57 } else if is_glob { 58 } else if is_glob {
58 tested_by!(glob_enum_group); 59 tested_by!(glob_enum_group);
59 if let Some(prefix) = prefix { 60 if let Some(prefix) = prefix {
60 cb(prefix, &tree, is_glob, ImportAlias::NoAlias) 61 cb(prefix, &tree, is_glob, None)
61 } 62 }
62 } 63 }
63 } 64 }