diff options
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r-- | crates/ra_hir_def/src/nameres/path_resolution.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/crates/ra_hir_def/src/nameres/path_resolution.rs b/crates/ra_hir_def/src/nameres/path_resolution.rs index 9b85ae018..695014c7b 100644 --- a/crates/ra_hir_def/src/nameres/path_resolution.rs +++ b/crates/ra_hir_def/src/nameres/path_resolution.rs | |||
@@ -180,13 +180,7 @@ impl CrateDefMap { | |||
180 | } | 180 | } |
181 | 181 | ||
182 | // Since it is a qualified path here, it should not contains legacy macros | 182 | // Since it is a qualified path here, it should not contains legacy macros |
183 | match self[module.local_id].scope.get(&segment, prefer_module(i)) { | 183 | self[module.local_id].scope.get(&segment, prefer_module(i)) |
184 | Some(def) => def, | ||
185 | _ => { | ||
186 | log::debug!("path segment {:?} not found", segment); | ||
187 | return ResolvePathResult::empty(ReachedFixedPoint::No); | ||
188 | } | ||
189 | } | ||
190 | } | 184 | } |
191 | ModuleDefId::AdtId(AdtId::EnumId(e)) => { | 185 | ModuleDefId::AdtId(AdtId::EnumId(e)) => { |
192 | // enum variant | 186 | // enum variant |
@@ -243,7 +237,7 @@ impl CrateDefMap { | |||
243 | // - std prelude | 237 | // - std prelude |
244 | let from_legacy_macro = | 238 | let from_legacy_macro = |
245 | self[module].scope.get_legacy_macro(name).map_or_else(PerNs::none, PerNs::macros); | 239 | self[module].scope.get_legacy_macro(name).map_or_else(PerNs::none, PerNs::macros); |
246 | let from_scope = self[module].scope.get(name, shadow).unwrap_or_else(PerNs::none); | 240 | let from_scope = self[module].scope.get(name, shadow); |
247 | let from_extern_prelude = | 241 | let from_extern_prelude = |
248 | self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it)); | 242 | self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it)); |
249 | let from_prelude = self.resolve_in_prelude(db, name, shadow); | 243 | let from_prelude = self.resolve_in_prelude(db, name, shadow); |
@@ -256,7 +250,7 @@ impl CrateDefMap { | |||
256 | name: &Name, | 250 | name: &Name, |
257 | shadow: BuiltinShadowMode, | 251 | shadow: BuiltinShadowMode, |
258 | ) -> PerNs { | 252 | ) -> PerNs { |
259 | let from_crate_root = self[self.root].scope.get(name, shadow).unwrap_or_else(PerNs::none); | 253 | let from_crate_root = self[self.root].scope.get(name, shadow); |
260 | let from_extern_prelude = self.resolve_name_in_extern_prelude(name); | 254 | let from_extern_prelude = self.resolve_name_in_extern_prelude(name); |
261 | 255 | ||
262 | from_crate_root.or(from_extern_prelude) | 256 | from_crate_root.or(from_extern_prelude) |
@@ -277,7 +271,7 @@ impl CrateDefMap { | |||
277 | keep = db.crate_def_map(prelude.krate); | 271 | keep = db.crate_def_map(prelude.krate); |
278 | &keep | 272 | &keep |
279 | }; | 273 | }; |
280 | def_map[prelude.local_id].scope.get(name, shadow).unwrap_or_else(PerNs::none) | 274 | def_map[prelude.local_id].scope.get(name, shadow) |
281 | } else { | 275 | } else { |
282 | PerNs::none() | 276 | PerNs::none() |
283 | } | 277 | } |