From 208ad97fdc9427f1243ac170c1c25f9f7d6ae964 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 25 Dec 2019 00:25:18 +0800 Subject: Remove AsyncOwner --- crates/ra_syntax/src/ast/extensions.rs | 4 ++++ crates/ra_syntax/src/ast/generated.rs | 1 - crates/ra_syntax/src/ast/traits.rs | 7 ------- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'crates/ra_syntax/src/ast') diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index a8f625176..baaef3023 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs @@ -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 { diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 73e1c407c..9f9d6e63c 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -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 { AstChildren::new(&self.syntax).next() diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 8bf6aa2f0..f99984fe0 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs @@ -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() } -- cgit v1.2.3