parent_module_from_def_id does not need to be a query.

This commit is contained in:
Camille GILLOT 2023-08-05 12:18:12 +00:00
parent fbc11e9690
commit 7a51b30ebd
3 changed files with 15 additions and 21 deletions

View file

@ -735,17 +735,6 @@ impl<'hir> Map<'hir> {
}
}
/// Returns the `OwnerId` of `id`'s nearest module parent, or `id` itself if no
/// module parent is in this map.
pub(super) fn get_module_parent_node(self, hir_id: HirId) -> OwnerId {
for (def_id, node) in self.parent_owner_iter(hir_id) {
if let OwnerNode::Item(&Item { kind: ItemKind::Mod(_), .. }) = node {
return def_id;
}
}
CRATE_OWNER_ID
}
/// When on an if expression, a match arm tail expression or a match arm, give back
/// the enclosing `if` or `match` expression.
///