simplify strip attrs

This commit is contained in:
Aleksey Kladov 2019-09-28 19:50:16 +03:00
parent dbdf0e24d5
commit 5dbbfda34a
5 changed files with 35 additions and 29 deletions

View file

@ -4,7 +4,7 @@
use itertools::Itertools;
use crate::{
ast::{self, child_opt, children, AstNode, SyntaxNode},
ast::{self, child_opt, children, AstChildren, AstNode, SyntaxNode},
SmolStr, SyntaxElement,
SyntaxKind::*,
SyntaxToken, T,
@ -203,6 +203,16 @@ 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),