aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-31 14:40:48 +0100
committerAleksey Kladov <[email protected]>2020-07-31 14:40:48 +0100
commita7ca6583fbce6f1bddce7b31ad5bb1fc0665b616 (patch)
treeb148be3186c9de3de526fe798eac36f27517c178 /crates/ra_syntax/src/ast/generated
parent4d38b0dce1884dab0da7394ccc979eef0a21076c (diff)
Handwrite Stmt
Diffstat (limited to 'crates/ra_syntax/src/ast/generated')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs22
1 files changed, 0 insertions, 22 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 286be1032..8ef72fec7 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -3380,28 +3380,6 @@ impl From<LetStmt> for Stmt {
3380impl From<ExprStmt> for Stmt { 3380impl From<ExprStmt> for Stmt {
3381 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } 3381 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) }
3382} 3382}
3383impl AstNode for Stmt {
3384 fn can_cast(kind: SyntaxKind) -> bool {
3385 match kind {
3386 LET_STMT | EXPR_STMT => true,
3387 _ => false,
3388 }
3389 }
3390 fn cast(syntax: SyntaxNode) -> Option<Self> {
3391 let res = match syntax.kind() {
3392 LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
3393 EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
3394 _ => return None,
3395 };
3396 Some(res)
3397 }
3398 fn syntax(&self) -> &SyntaxNode {
3399 match self {
3400 Stmt::LetStmt(it) => &it.syntax,
3401 Stmt::ExprStmt(it) => &it.syntax,
3402 }
3403 }
3404}
3405impl std::fmt::Display for Item { 3383impl std::fmt::Display for Item {
3406 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3384 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3407 std::fmt::Display::fmt(self.syntax(), f) 3385 std::fmt::Display::fmt(self.syntax(), f)