aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_impl
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 7215236f9..2014f1090 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -147,7 +147,7 @@ impl Module {
147 .def_id, 147 .def_id,
148 ); 148 );
149 149
150 for name in path.segments.iter() { 150 for segment in path.segments.iter() {
151 let curr = match curr_per_ns.as_ref().take_types() { 151 let curr = match curr_per_ns.as_ref().take_types() {
152 Some(r) => r, 152 Some(r) => r,
153 None => { 153 None => {
@@ -163,15 +163,17 @@ impl Module {
163 curr_per_ns = match curr.resolve(db) { 163 curr_per_ns = match curr.resolve(db) {
164 Def::Module(m) => { 164 Def::Module(m) => {
165 let scope = m.scope(db); 165 let scope = m.scope(db);
166 match scope.get(&name) { 166 match scope.get(&segment.name) {
167 Some(r) => r.def_id, 167 Some(r) => r.def_id,
168 None => PerNs::none(), 168 None => PerNs::none(),
169 } 169 }
170 } 170 }
171 Def::Enum(e) => { 171 Def::Enum(e) => {
172 // enum variant 172 // enum variant
173 let matching_variant = 173 let matching_variant = e
174 e.variants(db).into_iter().find(|(n, _variant)| n == name); 174 .variants(db)
175 .into_iter()
176 .find(|(n, _variant)| n == &segment.name);
175 177
176 match matching_variant { 178 match matching_variant {
177 Some((_n, variant)) => PerNs::both(variant.def_id(), e.def_id()), 179 Some((_n, variant)) => PerNs::both(variant.def_id(), e.def_id()),