diff options
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r-- | crates/ra_hir_def/src/nameres/path_resolution.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/nameres/path_resolution.rs b/crates/ra_hir_def/src/nameres/path_resolution.rs index 378d49455..9b85ae018 100644 --- a/crates/ra_hir_def/src/nameres/path_resolution.rs +++ b/crates/ra_hir_def/src/nameres/path_resolution.rs | |||
@@ -181,7 +181,7 @@ impl CrateDefMap { | |||
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 | match self[module.local_id].scope.get(&segment, prefer_module(i)) { |
184 | Some(def) => *def, | 184 | Some(def) => def, |
185 | _ => { | 185 | _ => { |
186 | log::debug!("path segment {:?} not found", segment); | 186 | log::debug!("path segment {:?} not found", segment); |
187 | return ResolvePathResult::empty(ReachedFixedPoint::No); | 187 | return ResolvePathResult::empty(ReachedFixedPoint::No); |
@@ -243,7 +243,7 @@ impl CrateDefMap { | |||
243 | // - std prelude | 243 | // - std prelude |
244 | let from_legacy_macro = | 244 | let from_legacy_macro = |
245 | self[module].scope.get_legacy_macro(name).map_or_else(PerNs::none, PerNs::macros); | 245 | self[module].scope.get_legacy_macro(name).map_or_else(PerNs::none, PerNs::macros); |
246 | let from_scope = self[module].scope.get(name, shadow).copied().unwrap_or_else(PerNs::none); | 246 | let from_scope = self[module].scope.get(name, shadow).unwrap_or_else(PerNs::none); |
247 | let from_extern_prelude = | 247 | let from_extern_prelude = |
248 | self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it)); | 248 | self.extern_prelude.get(name).map_or(PerNs::none(), |&it| PerNs::types(it)); |
249 | let from_prelude = self.resolve_in_prelude(db, name, shadow); | 249 | let from_prelude = self.resolve_in_prelude(db, name, shadow); |
@@ -256,8 +256,7 @@ impl CrateDefMap { | |||
256 | name: &Name, | 256 | name: &Name, |
257 | shadow: BuiltinShadowMode, | 257 | shadow: BuiltinShadowMode, |
258 | ) -> PerNs { | 258 | ) -> PerNs { |
259 | let from_crate_root = | 259 | let from_crate_root = self[self.root].scope.get(name, shadow).unwrap_or_else(PerNs::none); |
260 | self[self.root].scope.get(name, shadow).copied().unwrap_or_else(PerNs::none); | ||
261 | let from_extern_prelude = self.resolve_name_in_extern_prelude(name); | 260 | let from_extern_prelude = self.resolve_name_in_extern_prelude(name); |
262 | 261 | ||
263 | from_crate_root.or(from_extern_prelude) | 262 | from_crate_root.or(from_extern_prelude) |
@@ -278,7 +277,7 @@ impl CrateDefMap { | |||
278 | keep = db.crate_def_map(prelude.krate); | 277 | keep = db.crate_def_map(prelude.krate); |
279 | &keep | 278 | &keep |
280 | }; | 279 | }; |
281 | def_map[prelude.local_id].scope.get(name, shadow).copied().unwrap_or_else(PerNs::none) | 280 | def_map[prelude.local_id].scope.get(name, shadow).unwrap_or_else(PerNs::none) |
282 | } else { | 281 | } else { |
283 | PerNs::none() | 282 | PerNs::none() |
284 | } | 283 | } |