Remove AsyncOwner

This commit is contained in:
Edwin Cheng 2019-12-25 00:25:18 +08:00
parent 42813126d9
commit 208ad97fdc
5 changed files with 6 additions and 13 deletions

View file

@ -6,9 +6,7 @@ use hir_expand::{
name::{name, AsName, Name},
AstId, InFile,
};
use ra_syntax::ast::{
self, AstNode, AsyncOwner, ImplItem, ModuleItemOwner, NameOwner, TypeAscriptionOwner,
};
use ra_syntax::ast::{self, AstNode, ImplItem, ModuleItemOwner, NameOwner, TypeAscriptionOwner};
use crate::{
db::DefDatabase,

View file

@ -221,6 +221,10 @@ impl ast::FnDef {
.and_then(|it| it.into_token())
.filter(|it| it.kind() == T![;])
}
pub fn is_async(&self) -> bool {
self.syntax().children_with_tokens().any(|it| it.kind() == T![async])
}
}
impl ast::LetStmt {

View file

@ -1129,7 +1129,6 @@ impl ast::NameOwner for FnDef {}
impl ast::TypeParamsOwner for FnDef {}
impl ast::AttrsOwner for FnDef {}
impl ast::DocCommentsOwner for FnDef {}
impl ast::AsyncOwner for FnDef {}
impl FnDef {
pub fn param_list(&self) -> Option<ParamList> {
AstChildren::new(&self.syntax).next()

View file

@ -8,7 +8,6 @@ use crate::{
ast::{self, child_opt, children, AstChildren, AstNode, AstToken},
match_ast,
syntax_node::{SyntaxElementChildren, SyntaxNodeChildren},
SyntaxKind,
};
pub trait TypeAscriptionOwner: AstNode {
@ -106,12 +105,6 @@ pub trait AttrsOwner: AstNode {
}
}
pub trait AsyncOwner: AstNode {
fn is_async(&self) -> bool {
self.syntax().children_with_tokens().any(|t| t.kind() == SyntaxKind::ASYNC_KW)
}
}
pub trait DocCommentsOwner: AstNode {
fn doc_comments(&self) -> CommentIter {
CommentIter { iter: self.syntax().children_with_tokens() }

View file

@ -275,8 +275,7 @@ Grammar(
"NameOwner",
"TypeParamsOwner",
"AttrsOwner",
"DocCommentsOwner",
"AsyncOwner"
"DocCommentsOwner"
],
options: [ "ParamList", ["body", "BlockExpr"], "RetType" ],
),