File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,14 @@ pub fn differing_macro_contexts(lhs: Span, rhs: Span) -> bool {
6464/// ```
6565pub fn in_constant ( cx : & LateContext < ' _ , ' _ > , id : NodeId ) -> bool {
6666 let parent_id = cx. tcx . hir ( ) . get_parent ( id) ;
67- match cx. tcx . hir ( ) . body_owner_kind ( parent_id) {
68- hir:: BodyOwnerKind :: Fn | hir:: BodyOwnerKind :: Closure => false ,
69- hir:: BodyOwnerKind :: Const | hir:: BodyOwnerKind :: Static ( ..) => true ,
67+ match cx. tcx . hir ( ) . get ( parent_id) {
68+ | Node :: Item ( & Item { node : ItemKind :: Const ( ..) , .. } )
69+ | Node :: TraitItem ( & TraitItem { node : TraitItemKind :: Const ( ..) , .. } )
70+ | Node :: ImplItem ( & ImplItem { node : ImplItemKind :: Const ( ..) , .. } )
71+ | Node :: AnonConst ( _)
72+ | Node :: Item ( & Item { node : ItemKind :: Static ( ..) , .. } )
73+ => true ,
74+ _ => false ,
7075 }
7176}
7277
You can’t perform that action at this time.
0 commit comments