Remove the custom impl of AttrsOwner for ImplItem

The default impl should have the same behaviour, and it can be generated
by codegen.
See also `ModuleItem` and `NominalDef`
This commit is contained in:
DJMcNab 2019-11-18 18:13:56 +00:00
parent 7614439033
commit 27ce1e822b
3 changed files with 4 additions and 12 deletions

View File

@ -2,7 +2,7 @@
//! Extensions for various expressions live in a sibling `expr_extensions` module.
use crate::{
ast::{self, child_opt, children, AstChildren, AstNode, AttrInput, SyntaxNode},
ast::{self, child_opt, children, AstNode, AttrInput, SyntaxNode},
SmolStr, SyntaxElement,
SyntaxKind::*,
SyntaxToken, T,
@ -176,16 +176,6 @@ impl ast::ImplBlock {
}
}
impl ast::AttrsOwner for ast::ImplItem {
fn attrs(&self) -> AstChildren<ast::Attr> {
match self {
ast::ImplItem::FnDef(it) => it.attrs(),
ast::ImplItem::TypeAliasDef(it) => it.attrs(),
ast::ImplItem::ConstDef(it) => it.attrs(),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StructKind {
Tuple(ast::TupleFieldDefList),

View File

@ -1298,6 +1298,7 @@ impl AstNode for ImplItem {
}
}
}
impl ast::AttrsOwner for ImplItem {}
impl ImplItem {}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ImplTraitType {

View File

@ -401,7 +401,8 @@ Grammar(
traits: ["AttrsOwner"]
),
"ImplItem": (
enum: ["FnDef", "TypeAliasDef", "ConstDef"]
enum: ["FnDef", "TypeAliasDef", "ConstDef"],
traits: ["AttrsOwner"]
),
"TupleExpr": (