Skip to content

Commit 2d341e1

Browse files
committed
Remove parent_node.
1 parent 323f5b2 commit 2d341e1

File tree

1 file changed

+1
-10
lines changed
  • compiler/rustc_middle/src/hir/map

1 file changed

+1
-10
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ pub struct Entry<'hir> {
3030
node: Node<'hir>,
3131
}
3232

33-
impl<'hir> Entry<'hir> {
34-
fn parent_node(self) -> Option<HirId> {
35-
match self.node {
36-
Node::Crate(_) => None,
37-
_ => Some(self.parent),
38-
}
39-
}
40-
}
41-
4233
fn fn_decl<'hir>(node: Node<'hir>) -> Option<&'hir FnDecl<'hir>> {
4334
match node {
4435
Node::Item(Item { kind: ItemKind::Fn(sig, _, _), .. })
@@ -529,7 +520,7 @@ impl<'hir> Map<'hir> {
529520
/// from a node to the root of the HIR (unless you get back the same ID here,
530521
/// which can happen if the ID is not in the map itself or is just weird).
531522
pub fn get_parent_node(&self, hir_id: HirId) -> HirId {
532-
self.get_entry(hir_id).parent_node().unwrap_or(hir_id)
523+
self.get_entry(hir_id).parent
533524
}
534525

535526
/// Returns an iterator for the nodes in the ancestor tree of the `current_id`

0 commit comments

Comments
 (0)