diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 29 | ||||
-rw-r--r-- | crates/ra_hir/src/path.rs | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 82222d1ad..4e3659ad0 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -79,6 +79,35 @@ fn item_map_smoke_test() { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | #[test] | 81 | #[test] |
82 | fn use_trees() { | ||
83 | let (item_map, module_id) = item_map( | ||
84 | " | ||
85 | //- /lib.rs | ||
86 | mod foo; | ||
87 | |||
88 | use crate::foo::bar::{Baz, Quux}; | ||
89 | <|> | ||
90 | |||
91 | //- /foo/mod.rs | ||
92 | pub mod bar; | ||
93 | |||
94 | //- /foo/bar.rs | ||
95 | pub struct Baz; | ||
96 | pub enum Quux {}; | ||
97 | ", | ||
98 | ); | ||
99 | check_module_item_map( | ||
100 | &item_map, | ||
101 | module_id, | ||
102 | " | ||
103 | Baz: t v | ||
104 | Quux: t | ||
105 | foo: t | ||
106 | ", | ||
107 | ); | ||
108 | } | ||
109 | |||
110 | #[test] | ||
82 | fn re_exports() { | 111 | fn re_exports() { |
83 | let (item_map, module_id) = item_map( | 112 | let (item_map, module_id) = item_map( |
84 | " | 113 | " |
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs index 6f0b0da97..370e10bb8 100644 --- a/crates/ra_hir/src/path.rs +++ b/crates/ra_hir/src/path.rs | |||
@@ -150,7 +150,7 @@ fn convert_path(prefix: Option<Path>, path: &ast::Path) -> Option<Path> { | |||
150 | let prefix = if let Some(qual) = path.qualifier() { | 150 | let prefix = if let Some(qual) = path.qualifier() { |
151 | Some(convert_path(prefix, qual)?) | 151 | Some(convert_path(prefix, qual)?) |
152 | } else { | 152 | } else { |
153 | None | 153 | prefix |
154 | }; | 154 | }; |
155 | let segment = path.segment()?; | 155 | let segment = path.segment()?; |
156 | let res = match segment.kind()? { | 156 | let res = match segment.kind()? { |