From 2e2642efccd5855e4158b01a006e7884a96982bb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 20:51:43 +0200 Subject: Remove TypeAscriptionOwner --- crates/ra_syntax/src/ast/generated/nodes.rs | 14 +++++++------- crates/ra_syntax/src/ast/traits.rs | 6 ------ 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index c20ff53bf..207826979 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -35,12 +35,12 @@ pub struct Const { impl ast::AttrsOwner for Const {} impl ast::NameOwner for Const {} impl ast::VisibilityOwner for Const {} -impl ast::TypeAscriptionOwner for Const {} impl Const { pub fn default_token(&self) -> Option { support::token(&self.syntax, T![default]) } pub fn const_token(&self) -> Option { support::token(&self.syntax, T![const]) } pub fn underscore_token(&self) -> Option { support::token(&self.syntax, T![_]) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } pub fn body(&self) -> Option { support::child(&self.syntax) } pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } @@ -148,11 +148,11 @@ pub struct Static { impl ast::AttrsOwner for Static {} impl ast::NameOwner for Static {} impl ast::VisibilityOwner for Static {} -impl ast::TypeAscriptionOwner for Static {} impl Static { pub fn static_token(&self) -> Option { support::token(&self.syntax, T![static]) } pub fn mut_token(&self) -> Option { support::token(&self.syntax, T![mut]) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } pub fn body(&self) -> Option { support::child(&self.syntax) } pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } @@ -361,7 +361,6 @@ pub struct SelfParam { pub(crate) syntax: SyntaxNode, } impl ast::AttrsOwner for SelfParam {} -impl ast::TypeAscriptionOwner for SelfParam {} impl SelfParam { pub fn amp_token(&self) -> Option { support::token(&self.syntax, T![&]) } pub fn lifetime_token(&self) -> Option { @@ -370,16 +369,17 @@ impl SelfParam { pub fn mut_token(&self) -> Option { support::token(&self.syntax, T![mut]) } pub fn self_token(&self) -> Option { support::token(&self.syntax, T![self]) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Param { pub(crate) syntax: SyntaxNode, } impl ast::AttrsOwner for Param {} -impl ast::TypeAscriptionOwner for Param {} impl Param { pub fn pat(&self) -> Option { support::child(&self.syntax) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } pub fn dotdotdot_token(&self) -> Option { support::token(&self.syntax, T![...]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -414,9 +414,9 @@ pub struct RecordField { impl ast::AttrsOwner for RecordField {} impl ast::NameOwner for RecordField {} impl ast::VisibilityOwner for RecordField {} -impl ast::TypeAscriptionOwner for RecordField {} impl RecordField { pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleField { @@ -495,10 +495,10 @@ pub struct ConstParam { } impl ast::AttrsOwner for ConstParam {} impl ast::NameOwner for ConstParam {} -impl ast::TypeAscriptionOwner for ConstParam {} impl ConstParam { pub fn const_token(&self) -> Option { support::token(&self.syntax, T![const]) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } pub fn default_val(&self) -> Option { support::child(&self.syntax) } } @@ -1203,11 +1203,11 @@ pub struct LetStmt { pub(crate) syntax: SyntaxNode, } impl ast::AttrsOwner for LetStmt {} -impl ast::TypeAscriptionOwner for LetStmt {} impl LetStmt { pub fn let_token(&self) -> Option { support::token(&self.syntax, T![let]) } pub fn pat(&self) -> Option { support::child(&self.syntax) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } pub fn initializer(&self) -> Option { support::child(&self.syntax) } pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 113bd5d82..3a56b1674 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs @@ -9,12 +9,6 @@ use crate::{ SyntaxToken, T, }; -pub trait TypeAscriptionOwner: AstNode { - fn ascribed_type(&self) -> Option { - support::child(self.syntax()) - } -} - pub trait NameOwner: AstNode { fn name(&self) -> Option { support::child(self.syntax()) -- cgit v1.2.3