File tree Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -409,27 +409,24 @@ impl<'hir> Map<'hir> {
409409 }
410410
411411 pub fn item ( & self , id : HirId ) -> & ' hir Item < ' hir > {
412- self . read ( id) ;
413-
414- // N.B., intentionally bypass `self.krate()` so that we
415- // do not trigger a read of the whole krate here
416- self . krate . item ( id)
412+ match self . find ( id) . unwrap ( ) {
413+ Node :: Item ( item) => item,
414+ _ => bug ! ( ) ,
415+ }
417416 }
418417
419418 pub fn trait_item ( & self , id : TraitItemId ) -> & ' hir TraitItem < ' hir > {
420- self . read ( id. hir_id ) ;
421-
422- // N.B., intentionally bypass `self.krate()` so that we
423- // do not trigger a read of the whole krate here
424- self . krate . trait_item ( id)
419+ match self . find ( id. hir_id ) . unwrap ( ) {
420+ Node :: TraitItem ( item) => item,
421+ _ => bug ! ( ) ,
422+ }
425423 }
426424
427425 pub fn impl_item ( & self , id : ImplItemId ) -> & ' hir ImplItem < ' hir > {
428- self . read ( id. hir_id ) ;
429-
430- // N.B., intentionally bypass `self.krate()` so that we
431- // do not trigger a read of the whole krate here
432- self . krate . impl_item ( id)
426+ match self . find ( id. hir_id ) . unwrap ( ) {
427+ Node :: ImplItem ( item) => item,
428+ _ => bug ! ( ) ,
429+ }
433430 }
434431
435432 pub fn body ( & self , id : BodyId ) -> & ' hir Body < ' hir > {
You can’t perform that action at this time.
0 commit comments