intravisit: .expect_item -> .item
This commit is contained in:
parent
4b08c7e974
commit
62e9ccbe28
|
@ -226,7 +226,7 @@ pub trait Visitor<'v>: Sized {
|
|||
/// but cannot supply a `Map`; see `nested_visit_map` for advice.
|
||||
#[allow(unused_variables)]
|
||||
fn visit_nested_item(&mut self, id: ItemId) {
|
||||
let opt_item = self.nested_visit_map().inter().map(|map| map.expect_item(id.id));
|
||||
let opt_item = self.nested_visit_map().inter().map(|map| map.item(id.id));
|
||||
if let Some(item) = opt_item {
|
||||
self.visit_item(item);
|
||||
}
|
||||
|
|
|
@ -405,6 +405,14 @@ impl<'hir> Map<'hir> {
|
|||
self.forest.krate()
|
||||
}
|
||||
|
||||
pub fn item(&self, id: HirId) -> &'hir Item<'hir> {
|
||||
self.read(id);
|
||||
|
||||
// N.B., intentionally bypass `self.forest.krate()` so that we
|
||||
// do not trigger a read of the whole krate here
|
||||
self.forest.krate.item(id)
|
||||
}
|
||||
|
||||
pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir> {
|
||||
self.read(id.hir_id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue