Invoke attributes on the statement for statement items

This commit is contained in:
Aaron Hill
2020-11-24 14:47:49 -05:00
parent e9546bdbaf
commit 9c9f40656d
11 changed files with 574 additions and 9 deletions

View File

@@ -234,6 +234,15 @@ impl Annotatable {
pub fn derive_allowed(&self) -> bool {
match *self {
Annotatable::Stmt(ref stmt) => match stmt.kind {
ast::StmtKind::Item(ref item) => match item.kind {
ast::ItemKind::Struct(..)
| ast::ItemKind::Enum(..)
| ast::ItemKind::Union(..) => true,
_ => false,
},
_ => false,
},
Annotatable::Item(ref item) => match item.kind {
ast::ItemKind::Struct(..) | ast::ItemKind::Enum(..) | ast::ItemKind::Union(..) => {
true