@@ -454,30 +454,18 @@ impl<'hir> Map<'hir> {
454454 ///
455455 /// Panics if `LocalDefId` does not have an associated body.
456456 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 < ' _ > > {
467457 match self . get ( id) {
468458 Node :: Item ( & Item { kind : ItemKind :: Const ( ..) , .. } )
469459 | Node :: TraitItem ( & TraitItem { kind : TraitItemKind :: Const ( ..) , .. } )
470460 | Node :: ImplItem ( & ImplItem { kind : ImplItemKind :: Const ( ..) , .. } )
471- | Node :: AnonConst ( _) => Ok ( BodyOwnerKind :: Const ) ,
461+ | Node :: AnonConst ( _) => BodyOwnerKind :: Const ,
472462 Node :: Ctor ( ..)
473463 | Node :: Item ( & Item { kind : ItemKind :: Fn ( ..) , .. } )
474464 | 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) ,
481469 }
482470 }
483471
0 commit comments