Skip to content

Commit 9c4308e

Browse files
committed
Update find
1 parent d5827d8 commit 9c4308e

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
@@ -607,13 +607,8 @@ impl<'hir> Map<'hir> {
607607

608608
/// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
609609
pub fn find(&self, hir_id: HirId) -> Option<Node<'hir>> {
610-
let result = self.find_entry(hir_id).and_then(|entry| {
611-
if let Node::Crate(..) = entry.node { None } else { Some(entry.node) }
612-
});
613-
if result.is_some() {
614-
self.read(hir_id);
615-
}
616-
result
610+
let node = self.get_entry(hir_id).node;
611+
if let Node::Crate(..) = node { None } else { Some(node) }
617612
}
618613

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

0 commit comments

Comments
 (0)