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