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_hir_def/src/data.rs | 4 +--- crates/ra_syntax/src/ast/extensions.rs | 4 ++++ crates/ra_syntax/src/ast/generated.rs | 1 - crates/ra_syntax/src/ast/traits.rs | 7 ------- crates/ra_syntax/src/grammar.ron | 3 +-- 5 files changed, 6 insertions(+), 13 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index a1b31c411..c900a6a18 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs @@ -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, 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() } diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 7d11f0176..08aafb610 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -275,8 +275,7 @@ Grammar( "NameOwner", "TypeParamsOwner", "AttrsOwner", - "DocCommentsOwner", - "AsyncOwner" + "DocCommentsOwner" ], options: [ "ParamList", ["body", "BlockExpr"], "RetType" ], ), -- cgit v1.2.3