diff options
Diffstat (limited to 'crates/hir_def/src/nameres.rs')
-rw-r--r-- | crates/hir_def/src/nameres.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index ebfcc26c4..9e6aa9607 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs | |||
@@ -367,10 +367,7 @@ impl DefMap { | |||
367 | pub fn containing_module(&self, local_mod: LocalModuleId) -> Option<ModuleId> { | 367 | pub fn containing_module(&self, local_mod: LocalModuleId) -> Option<ModuleId> { |
368 | match &self[local_mod].parent { | 368 | match &self[local_mod].parent { |
369 | Some(parent) => Some(self.module_id(*parent)), | 369 | Some(parent) => Some(self.module_id(*parent)), |
370 | None => match &self.block { | 370 | None => self.block.as_ref().map(|block| block.parent), |
371 | Some(block) => Some(block.parent), | ||
372 | None => None, | ||
373 | }, | ||
374 | } | 371 | } |
375 | } | 372 | } |
376 | 373 | ||