From 01d6c3836b1c540b14d9c9e17974df64afa978c0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 19:10:46 +0200 Subject: Dead code --- crates/ra_syntax/src/ast/generated/nodes.rs | 178 ++++++++++++---------------- 1 file changed, 76 insertions(+), 102 deletions(-) (limited to 'crates/ra_syntax/src/ast/generated') diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index e3b3f44cc..e898c9181 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -502,6 +502,23 @@ impl ConstParam { pub fn default_val(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Literal { + pub(crate) syntax: SyntaxNode, +} +impl Literal {} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct TokenTree { + pub(crate) syntax: SyntaxNode, +} +impl TokenTree { + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } + pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } + pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } + pub fn l_brack_token(&self) -> Option { support::token(&self.syntax, T!['[']) } + pub fn r_brack_token(&self) -> Option { support::token(&self.syntax, T![']']) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParenType { pub(crate) syntax: SyntaxNode, } @@ -908,11 +925,6 @@ pub struct BinExpr { impl ast::AttrsOwner for BinExpr {} impl BinExpr {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Literal { - pub(crate) syntax: SyntaxNode, -} -impl Literal {} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MatchExpr { pub(crate) syntax: SyntaxNode, } @@ -1131,18 +1143,6 @@ impl TuplePat { pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TokenTree { - pub(crate) syntax: SyntaxNode, -} -impl TokenTree { - pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } - pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } - pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } - pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } - pub fn l_brack_token(&self) -> Option { support::token(&self.syntax, T!['[']) } - pub fn r_brack_token(&self) -> Option { support::token(&self.syntax, T![']']) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroDef { pub(crate) syntax: SyntaxNode, } @@ -1263,16 +1263,6 @@ impl ConstArg { pub fn block_expr(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MetaItem { - pub(crate) syntax: SyntaxNode, -} -impl MetaItem { - pub fn path(&self) -> Option { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } - pub fn attr_input(&self) -> Option { support::child(&self.syntax) } - pub fn nested_meta_items(&self) -> AstChildren { support::children(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Item { Const(Const), Enum(Enum), @@ -1388,17 +1378,17 @@ pub enum GenericParam { } impl ast::AttrsOwner for GenericParam {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum AttrInput { + Literal(Literal), + TokenTree(TokenTree), +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Stmt { LetStmt(LetStmt), ExprStmt(ExprStmt), } impl ast::AttrsOwner for Stmt {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum AttrInput { - Literal(Literal), - TokenTree(TokenTree), -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum AdtDef { Struct(Struct), Enum(Enum), @@ -1892,6 +1882,28 @@ impl AstNode for ConstParam { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl AstNode for Literal { + fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} +impl AstNode for TokenTree { + fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} impl AstNode for ParenType { fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } fn cast(syntax: SyntaxNode) -> Option { @@ -2354,17 +2366,6 @@ impl AstNode for BinExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Literal { - fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { &self.syntax } -} impl AstNode for MatchExpr { fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } fn cast(syntax: SyntaxNode) -> Option { @@ -2629,17 +2630,6 @@ impl AstNode for TuplePat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TokenTree { - fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { &self.syntax } -} impl AstNode for MacroDef { fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } fn cast(syntax: SyntaxNode) -> Option { @@ -2772,17 +2762,6 @@ impl AstNode for ConstArg { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MetaItem { - fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { &self.syntax } -} impl From for Item { fn from(node: Const) -> Item { Item::Const(node) } } @@ -3363,59 +3342,59 @@ impl AstNode for GenericParam { } } } -impl From for Stmt { - fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } +impl From for AttrInput { + fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) } } -impl From for Stmt { - fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } +impl From for AttrInput { + fn from(node: TokenTree) -> AttrInput { AttrInput::TokenTree(node) } } -impl AstNode for Stmt { +impl AstNode for AttrInput { fn can_cast(kind: SyntaxKind) -> bool { match kind { - LET_STMT | EXPR_STMT => true, + LITERAL | TOKEN_TREE => true, _ => false, } } fn cast(syntax: SyntaxNode) -> Option { let res = match syntax.kind() { - LET_STMT => Stmt::LetStmt(LetStmt { syntax }), - EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), + LITERAL => AttrInput::Literal(Literal { syntax }), + TOKEN_TREE => AttrInput::TokenTree(TokenTree { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - Stmt::LetStmt(it) => &it.syntax, - Stmt::ExprStmt(it) => &it.syntax, + AttrInput::Literal(it) => &it.syntax, + AttrInput::TokenTree(it) => &it.syntax, } } } -impl From for AttrInput { - fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) } +impl From for Stmt { + fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } } -impl From for AttrInput { - fn from(node: TokenTree) -> AttrInput { AttrInput::TokenTree(node) } +impl From for Stmt { + fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } } -impl AstNode for AttrInput { +impl AstNode for Stmt { fn can_cast(kind: SyntaxKind) -> bool { match kind { - LITERAL | TOKEN_TREE => true, + LET_STMT | EXPR_STMT => true, _ => false, } } fn cast(syntax: SyntaxNode) -> Option { let res = match syntax.kind() { - LITERAL => AttrInput::Literal(Literal { syntax }), - TOKEN_TREE => AttrInput::TokenTree(TokenTree { syntax }), + LET_STMT => Stmt::LetStmt(LetStmt { syntax }), + EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - AttrInput::Literal(it) => &it.syntax, - AttrInput::TokenTree(it) => &it.syntax, + Stmt::LetStmt(it) => &it.syntax, + Stmt::ExprStmt(it) => &it.syntax, } } } @@ -3492,12 +3471,12 @@ impl std::fmt::Display for GenericParam { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Stmt { +impl std::fmt::Display for AttrInput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for AttrInput { +impl std::fmt::Display for Stmt { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -3727,6 +3706,16 @@ impl std::fmt::Display for ConstParam { std::fmt::Display::fmt(self.syntax(), f) } } +impl std::fmt::Display for Literal { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for TokenTree { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} impl std::fmt::Display for ParenType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3937,11 +3926,6 @@ impl std::fmt::Display for BinExpr { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Literal { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for MatchExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -4062,11 +4046,6 @@ impl std::fmt::Display for TuplePat { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TokenTree { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for MacroDef { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -4127,8 +4106,3 @@ impl std::fmt::Display for ConstArg { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MetaItem { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -- cgit v1.2.3