2308: Remove the custom impl of AttrsOwner for ImplItem r=matklad a=DJMcNab

The default impl should have the same behaviour, and it can be generated by codegen.
See also `ModuleItem` and `NominalDef`.

Also see 5dbbfda34a (r36011245)

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
This commit is contained in:
bors[bot] 2019-11-18 18:21:44 +00:00 committed by GitHub
commit a4f21801c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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. //! Extensions for various expressions live in a sibling `expr_extensions` module.
use crate::{ use crate::{
ast::{self, child_opt, children, AstChildren, AstNode, AttrInput, SyntaxNode}, ast::{self, child_opt, children, AstNode, AttrInput, SyntaxNode},
SmolStr, SyntaxElement, SmolStr, SyntaxElement,
SyntaxKind::*, SyntaxKind::*,
SyntaxToken, T, 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)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum StructKind { pub enum StructKind {
Tuple(ast::TupleFieldDefList), Tuple(ast::TupleFieldDefList),

View File

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

View File

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