aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-30 19:53:36 +0100
committerGitHub <[email protected]>2020-07-30 19:53:36 +0100
commit134d3c3c5068abc5ed3e03fe5df2b524ea70753d (patch)
treede4342a453b3b504178dd17c46fab3e1d6e995d2 /crates/ra_syntax/src
parent6f5b53013c54fa6d8429b717998cdb77a4d68b2c (diff)
parent2e2642efccd5855e4158b01a006e7884a96982bb (diff)
Merge #5612
5612: Remove TypeAscriptionOwner r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs14
-rw-r--r--crates/ra_syntax/src/ast/traits.rs6
2 files changed, 7 insertions, 13 deletions
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 {
35impl ast::AttrsOwner for Const {} 35impl ast::AttrsOwner for Const {}
36impl ast::NameOwner for Const {} 36impl ast::NameOwner for Const {}
37impl ast::VisibilityOwner for Const {} 37impl ast::VisibilityOwner for Const {}
38impl ast::TypeAscriptionOwner for Const {}
39impl Const { 38impl Const {
40 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 39 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
41 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 40 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
42 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } 41 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
43 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 42 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
43 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
44 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 44 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
45 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 45 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
46 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 46 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
@@ -148,11 +148,11 @@ pub struct Static {
148impl ast::AttrsOwner for Static {} 148impl ast::AttrsOwner for Static {}
149impl ast::NameOwner for Static {} 149impl ast::NameOwner for Static {}
150impl ast::VisibilityOwner for Static {} 150impl ast::VisibilityOwner for Static {}
151impl ast::TypeAscriptionOwner for Static {}
152impl Static { 151impl Static {
153 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } 152 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
154 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 153 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
155 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 154 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
155 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
156 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 156 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
157 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 157 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
158 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 158 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
@@ -361,7 +361,6 @@ pub struct SelfParam {
361 pub(crate) syntax: SyntaxNode, 361 pub(crate) syntax: SyntaxNode,
362} 362}
363impl ast::AttrsOwner for SelfParam {} 363impl ast::AttrsOwner for SelfParam {}
364impl ast::TypeAscriptionOwner for SelfParam {}
365impl SelfParam { 364impl SelfParam {
366 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 365 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
367 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 366 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
@@ -370,16 +369,17 @@ impl SelfParam {
370 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 369 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
371 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } 370 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
372 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 371 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
372 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
373} 373}
374#[derive(Debug, Clone, PartialEq, Eq, Hash)] 374#[derive(Debug, Clone, PartialEq, Eq, Hash)]
375pub struct Param { 375pub struct Param {
376 pub(crate) syntax: SyntaxNode, 376 pub(crate) syntax: SyntaxNode,
377} 377}
378impl ast::AttrsOwner for Param {} 378impl ast::AttrsOwner for Param {}
379impl ast::TypeAscriptionOwner for Param {}
380impl Param { 379impl Param {
381 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 380 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
382 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 381 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
382 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
383 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } 383 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
384} 384}
385#[derive(Debug, Clone, PartialEq, Eq, Hash)] 385#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -414,9 +414,9 @@ pub struct RecordField {
414impl ast::AttrsOwner for RecordField {} 414impl ast::AttrsOwner for RecordField {}
415impl ast::NameOwner for RecordField {} 415impl ast::NameOwner for RecordField {}
416impl ast::VisibilityOwner for RecordField {} 416impl ast::VisibilityOwner for RecordField {}
417impl ast::TypeAscriptionOwner for RecordField {}
418impl RecordField { 417impl RecordField {
419 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 418 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
419 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
420} 420}
421#[derive(Debug, Clone, PartialEq, Eq, Hash)] 421#[derive(Debug, Clone, PartialEq, Eq, Hash)]
422pub struct TupleField { 422pub struct TupleField {
@@ -495,10 +495,10 @@ pub struct ConstParam {
495} 495}
496impl ast::AttrsOwner for ConstParam {} 496impl ast::AttrsOwner for ConstParam {}
497impl ast::NameOwner for ConstParam {} 497impl ast::NameOwner for ConstParam {}
498impl ast::TypeAscriptionOwner for ConstParam {}
499impl ConstParam { 498impl ConstParam {
500 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 499 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
501 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 500 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
501 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
502 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 502 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
503 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } 503 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
504} 504}
@@ -1203,11 +1203,11 @@ pub struct LetStmt {
1203 pub(crate) syntax: SyntaxNode, 1203 pub(crate) syntax: SyntaxNode,
1204} 1204}
1205impl ast::AttrsOwner for LetStmt {} 1205impl ast::AttrsOwner for LetStmt {}
1206impl ast::TypeAscriptionOwner for LetStmt {}
1207impl LetStmt { 1206impl LetStmt {
1208 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } 1207 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
1209 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1208 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1210 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 1209 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1210 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1211 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 1211 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1212 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } 1212 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
1213 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 1213 pub fn semicolon_token(&self) -> Option<SyntaxToken> { 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::{
9 SyntaxToken, T, 9 SyntaxToken, T,
10}; 10};
11 11
12pub trait TypeAscriptionOwner: AstNode {
13 fn ascribed_type(&self) -> Option<ast::TypeRef> {
14 support::child(self.syntax())
15 }
16}
17
18pub trait NameOwner: AstNode { 12pub trait NameOwner: AstNode {
19 fn name(&self) -> Option<ast::Name> { 13 fn name(&self) -> Option<ast::Name> {
20 support::child(self.syntax()) 14 support::child(self.syntax())