We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f553a0f + 578da99 commit 4e69c5dCopy full SHA for 4e69c5d
compiler/rustc_middle/src/hir/map/mod.rs
@@ -710,15 +710,10 @@ impl<'hir> Map<'hir> {
710
let mut scope = id;
711
loop {
712
scope = self.get_enclosing_scope(scope).unwrap_or(CRATE_HIR_ID);
713
- if scope == CRATE_HIR_ID {
714
- return CRATE_HIR_ID;
715
- }
716
- match self.get(scope) {
717
- Node::Block(_) => {}
718
- _ => break,
+ if scope == CRATE_HIR_ID || !matches!(self.get(scope), Node::Block(_)) {
+ return scope;
719
}
720
721
- scope
722
723
724
pub fn get_parent_did(&self, id: HirId) -> LocalDefId {
0 commit comments