Skip to content

Commit 02b6df7

Browse files
committed
Update find
1 parent a9ec0fa commit 02b6df7

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,8 @@ impl<'hir> Map<'hir> {
612612

613613
/// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
614614
pub fn find(&self, hir_id: HirId) -> Option<Node<'hir>> {
615-
let result = self.find_entry(hir_id).and_then(|entry| {
616-
if let Node::Crate(..) = entry.node { None } else { Some(entry.node) }
617-
});
618-
if result.is_some() {
619-
self.read(hir_id);
620-
}
621-
result
615+
let node = self.get_entry(hir_id).node;
616+
if let Node::Crate(..) = node { None } else { Some(node) }
622617
}
623618

624619
/// Similar to `get_parent`; returns the parent HIR Id, or just `hir_id` if there

0 commit comments

Comments
 (0)