diff options
author | Kevin DeLorey <[email protected]> | 2020-02-09 16:25:47 +0000 |
---|---|---|
committer | Kevin DeLorey <[email protected]> | 2020-02-09 16:37:43 +0000 |
commit | a957c473fdb79880c39b73dc9e0c923093cf16ac (patch) | |
tree | f998b548f530ce604651e0e6af314ed2ec74b3b5 /crates/ra_hir_def/src/path/lower/lower_use.rs | |
parent | 22caf982b99c54058e2e9200aeea0e61cada284a (diff) | |
parent | 1b9b13b4b4a75b5531c3f046ce6bf72d681f2732 (diff) |
Merge branch 'master' into kdelorey/complete-trait-impl
Diffstat (limited to 'crates/ra_hir_def/src/path/lower/lower_use.rs')
-rw-r--r-- | crates/ra_hir_def/src/path/lower/lower_use.rs | 15 |
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 @@ | |||
4 | use std::iter; | 4 | use std::iter; |
5 | 5 | ||
6 | use either::Either; | 6 | use either::Either; |
7 | use hir_expand::{ | 7 | use hir_expand::{hygiene::Hygiene, name::AsName}; |
8 | hygiene::Hygiene, | ||
9 | name::{AsName, Name}, | ||
10 | }; | ||
11 | use ra_syntax::ast::{self, NameOwner}; | 8 | use ra_syntax::ast::{self, NameOwner}; |
12 | use test_utils::tested_by; | 9 | use test_utils::tested_by; |
13 | 10 | ||
14 | use crate::path::{ModPath, PathKind}; | 11 | use crate::path::{ImportAlias, ModPath, PathKind}; |
15 | 12 | ||
16 | pub(crate) fn lower_use_tree( | 13 | pub(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. |