aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 19:27:39 +0100
committerAleksey Kladov <[email protected]>2020-07-30 19:38:15 +0100
commitfbe60a2e284035d16c2a1ee743ee88db418689aa (patch)
treec09cf0434ecf282cf1763d34cf838952db105e0a /crates/ra_syntax
parentfcce07d2d1b07cf4578af65b00a243e743a67f05 (diff)
simplify
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs36
1 files changed, 18 insertions, 18 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 05f75871d..c20ff53bf 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -322,9 +322,9 @@ pub struct ParamList {
322} 322}
323impl ParamList { 323impl ParamList {
324 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 324 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
325 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
326 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } 325 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
327 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } 326 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
327 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
328 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 328 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
329} 329}
330#[derive(Debug, Clone, PartialEq, Eq, Hash)] 330#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -357,17 +357,6 @@ impl BlockExpr {
357 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 357 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
358} 358}
359#[derive(Debug, Clone, PartialEq, Eq, Hash)] 359#[derive(Debug, Clone, PartialEq, Eq, Hash)]
360pub struct Param {
361 pub(crate) syntax: SyntaxNode,
362}
363impl ast::AttrsOwner for Param {}
364impl ast::TypeAscriptionOwner for Param {}
365impl Param {
366 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
367 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
368 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
369}
370#[derive(Debug, Clone, PartialEq, Eq, Hash)]
371pub struct SelfParam { 360pub struct SelfParam {
372 pub(crate) syntax: SyntaxNode, 361 pub(crate) syntax: SyntaxNode,
373} 362}
@@ -383,6 +372,17 @@ impl SelfParam {
383 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 372 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
384} 373}
385#[derive(Debug, Clone, PartialEq, Eq, Hash)] 374#[derive(Debug, Clone, PartialEq, Eq, Hash)]
375pub struct Param {
376 pub(crate) syntax: SyntaxNode,
377}
378impl ast::AttrsOwner for Param {}
379impl ast::TypeAscriptionOwner for Param {}
380impl Param {
381 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
382 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
383 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
384}
385#[derive(Debug, Clone, PartialEq, Eq, Hash)]
386pub struct TypeBoundList { 386pub struct TypeBoundList {
387 pub(crate) syntax: SyntaxNode, 387 pub(crate) syntax: SyntaxNode,
388} 388}
@@ -1724,8 +1724,8 @@ impl AstNode for BlockExpr {
1724 } 1724 }
1725 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1725 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1726} 1726}
1727impl AstNode for Param { 1727impl AstNode for SelfParam {
1728 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } 1728 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
1729 fn cast(syntax: SyntaxNode) -> Option<Self> { 1729 fn cast(syntax: SyntaxNode) -> Option<Self> {
1730 if Self::can_cast(syntax.kind()) { 1730 if Self::can_cast(syntax.kind()) {
1731 Some(Self { syntax }) 1731 Some(Self { syntax })
@@ -1735,8 +1735,8 @@ impl AstNode for Param {
1735 } 1735 }
1736 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1736 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1737} 1737}
1738impl AstNode for SelfParam { 1738impl AstNode for Param {
1739 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } 1739 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
1740 fn cast(syntax: SyntaxNode) -> Option<Self> { 1740 fn cast(syntax: SyntaxNode) -> Option<Self> {
1741 if Self::can_cast(syntax.kind()) { 1741 if Self::can_cast(syntax.kind()) {
1742 Some(Self { syntax }) 1742 Some(Self { syntax })
@@ -3599,12 +3599,12 @@ impl std::fmt::Display for BlockExpr {
3599 std::fmt::Display::fmt(self.syntax(), f) 3599 std::fmt::Display::fmt(self.syntax(), f)
3600 } 3600 }
3601} 3601}
3602impl std::fmt::Display for Param { 3602impl std::fmt::Display for SelfParam {
3603 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3603 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3604 std::fmt::Display::fmt(self.syntax(), f) 3604 std::fmt::Display::fmt(self.syntax(), f)
3605 } 3605 }
3606} 3606}
3607impl std::fmt::Display for SelfParam { 3607impl std::fmt::Display for Param {
3608 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3608 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3609 std::fmt::Display::fmt(self.syntax(), f) 3609 std::fmt::Display::fmt(self.syntax(), f)
3610 } 3610 }