@@ -454,30 +454,18 @@ impl<'hir> Map<'hir> {
454
454
///
455
455
/// Panics if `LocalDefId` does not have an associated body.
456
456
pub fn body_owner_kind ( & self , id : HirId ) -> BodyOwnerKind {
457
- match self . opt_body_owner_kind ( id) {
458
- Ok ( kind) => kind,
459
- Err ( node) => bug ! ( "{:#?} is not a body node" , node) ,
460
- }
461
- }
462
-
463
- /// Returns the `BodyOwnerKind` of this `LocalDefId`.
464
- ///
465
- /// Returns the `Node` if `LocalDefId` does not have an associated body.
466
- pub fn opt_body_owner_kind ( & self , id : HirId ) -> Result < BodyOwnerKind , Node < ' _ > > {
467
457
match self . get ( id) {
468
458
Node :: Item ( & Item { kind : ItemKind :: Const ( ..) , .. } )
469
459
| Node :: TraitItem ( & TraitItem { kind : TraitItemKind :: Const ( ..) , .. } )
470
460
| Node :: ImplItem ( & ImplItem { kind : ImplItemKind :: Const ( ..) , .. } )
471
- | Node :: AnonConst ( _) => Ok ( BodyOwnerKind :: Const ) ,
461
+ | Node :: AnonConst ( _) => BodyOwnerKind :: Const ,
472
462
Node :: Ctor ( ..)
473
463
| Node :: Item ( & Item { kind : ItemKind :: Fn ( ..) , .. } )
474
464
| Node :: TraitItem ( & TraitItem { kind : TraitItemKind :: Fn ( ..) , .. } )
475
- | Node :: ImplItem ( & ImplItem { kind : ImplItemKind :: Fn ( ..) , .. } ) => Ok ( BodyOwnerKind :: Fn ) ,
476
- Node :: Item ( & Item { kind : ItemKind :: Static ( _, m, _) , .. } ) => {
477
- Ok ( BodyOwnerKind :: Static ( m) )
478
- }
479
- Node :: Expr ( & Expr { kind : ExprKind :: Closure ( ..) , .. } ) => Ok ( BodyOwnerKind :: Closure ) ,
480
- node => Err ( node) ,
465
+ | Node :: ImplItem ( & ImplItem { kind : ImplItemKind :: Fn ( ..) , .. } ) => BodyOwnerKind :: Fn ,
466
+ Node :: Item ( & Item { kind : ItemKind :: Static ( _, m, _) , .. } ) => BodyOwnerKind :: Static ( m) ,
467
+ Node :: Expr ( & Expr { kind : ExprKind :: Closure ( ..) , .. } ) => BodyOwnerKind :: Closure ,
468
+ node => bug ! ( "{:#?} is not a body node" , node) ,
481
469
}
482
470
}
483
471
0 commit comments