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> {
409
409
}
410
410
411
411
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
+ }
417
416
}
418
417
419
418
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
+ }
425
423
}
426
424
427
425
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
+ }
433
430
}
434
431
435
432
pub fn body ( & self , id : BodyId ) -> & ' hir Body < ' hir > {
You can’t perform that action at this time.
0 commit comments