aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/path
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/path')
-rw-r--r--crates/ra_hir_def/src/path/lower/lower_use.rs15
1 files changed, 8 insertions, 7 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 531878174..d2bc9d193 100644
--- a/crates/ra_hir_def/src/path/lower/lower_use.rs
+++ b/crates/ra_hir_def/src/path/lower/lower_use.rs
@@ -4,20 +4,17 @@
4use std::iter; 4use std::iter;
5 5
6use either::Either; 6use either::Either;
7use hir_expand::{ 7use hir_expand::{hygiene::Hygiene, name::AsName};
8 hygiene::Hygiene,
9 name::{AsName, Name},
10};
11use ra_syntax::ast::{self, NameOwner}; 8use ra_syntax::ast::{self, NameOwner};
12use test_utils::tested_by; 9use test_utils::tested_by;
13 10
14use crate::path::{ModPath, PathKind}; 11use crate::path::{ImportAlias, ModPath, PathKind};
15 12
16pub(crate) fn lower_use_tree( 13pub(crate) fn lower_use_tree(
17 prefix: Option<ModPath>, 14 prefix: Option<ModPath>,
18 tree: ast::UseTree, 15 tree: ast::UseTree,
19 hygiene: &Hygiene, 16 hygiene: &Hygiene,
20 cb: &mut dyn FnMut(ModPath, &ast::UseTree, bool, Option<Name>), 17 cb: &mut dyn FnMut(ModPath, &ast::UseTree, bool, Option<ImportAlias>),
21) { 18) {
22 if let Some(use_tree_list) = tree.use_tree_list() { 19 if let Some(use_tree_list) = tree.use_tree_list() {
23 let prefix = match tree.path() { 20 let prefix = match tree.path() {
@@ -34,7 +31,11 @@ pub(crate) fn lower_use_tree(
34 lower_use_tree(prefix.clone(), child_tree, hygiene, cb); 31 lower_use_tree(prefix.clone(), child_tree, hygiene, cb);
35 } 32 }
36 } else { 33 } else {
37 let alias = tree.alias().and_then(|a| a.name()).map(|a| a.as_name()); 34 let alias = tree.alias().map(|a| {
35 a.name()
36 .map(|it| it.as_name())
37 .map_or(ImportAlias::Underscore, |a| ImportAlias::Alias(a))
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() {
40 // Handle self in a path. 41 // Handle self in a path.