about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-03-03 21:46:09 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-04-29 21:36:55 +0200
commit2d341e1e288cfb39cf7e8644c468654a9b8e0fca (patch)
treee39dede3ffc8bcbd9a15f52afae013af5bbea104
parent323f5b2ac922cac6d9a954ad55b2552b6da519b3 (diff)
downloadrust-2d341e1e288cfb39cf7e8644c468654a9b8e0fca.tar.gz
rust-2d341e1e288cfb39cf7e8644c468654a9b8e0fca.zip
Remove parent_node.
-rw-r--r--compiler/rustc_middle/src/hir/map/mod.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs
index 1148c587c4d..973707c59fa 100644
--- a/compiler/rustc_middle/src/hir/map/mod.rs
+++ b/compiler/rustc_middle/src/hir/map/mod.rs
@@ -30,15 +30,6 @@ pub struct Entry<'hir> {
     node: Node<'hir>,
 }
 
-impl<'hir> Entry<'hir> {
-    fn parent_node(self) -> Option<HirId> {
-        match self.node {
-            Node::Crate(_) => None,
-            _ => Some(self.parent),
-        }
-    }
-}
-
 fn fn_decl<'hir>(node: Node<'hir>) -> Option<&'hir FnDecl<'hir>> {
     match node {
         Node::Item(Item { kind: ItemKind::Fn(sig, _, _), .. })
@@ -529,7 +520,7 @@ impl<'hir> Map<'hir> {
     /// from a node to the root of the HIR (unless you get back the same ID here,
     /// which can happen if the ID is not in the map itself or is just weird).
     pub fn get_parent_node(&self, hir_id: HirId) -> HirId {
-        self.get_entry(hir_id).parent_node().unwrap_or(hir_id)
+        self.get_entry(hir_id).parent
     }
 
     /// Returns an iterator for the nodes in the ancestor tree of the `current_id`