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 @@ -404,27 +404,24 @@ impl<'hir> Map<'hir> {
404
404
}
405
405
406
406
pub fn item ( & self , id : HirId ) -> & ' hir Item < ' hir > {
407
- self . read ( id) ;
408
-
409
- // N.B., intentionally bypass `self.krate()` so that we
410
- // do not trigger a read of the whole krate here
411
- self . krate . item ( id)
407
+ match self . find ( id) . unwrap ( ) {
408
+ Node :: Item ( item) => item,
409
+ _ => bug ! ( ) ,
410
+ }
412
411
}
413
412
414
413
pub fn trait_item ( & self , id : TraitItemId ) -> & ' hir TraitItem < ' hir > {
415
- self . read ( id. hir_id ) ;
416
-
417
- // N.B., intentionally bypass `self.krate()` so that we
418
- // do not trigger a read of the whole krate here
419
- self . krate . trait_item ( id)
414
+ match self . find ( id. hir_id ) . unwrap ( ) {
415
+ Node :: TraitItem ( item) => item,
416
+ _ => bug ! ( ) ,
417
+ }
420
418
}
421
419
422
420
pub fn impl_item ( & self , id : ImplItemId ) -> & ' hir ImplItem < ' hir > {
423
- self . read ( id. hir_id ) ;
424
-
425
- // N.B., intentionally bypass `self.krate()` so that we
426
- // do not trigger a read of the whole krate here
427
- self . krate . impl_item ( id)
421
+ match self . find ( id. hir_id ) . unwrap ( ) {
422
+ Node :: ImplItem ( item) => item,
423
+ _ => bug ! ( ) ,
424
+ }
428
425
}
429
426
430
427
pub fn body ( & self , id : BodyId ) -> & ' hir Body < ' hir > {
You can’t perform that action at this time.
0 commit comments