From 7a49165f5d5c8186edd04f874eae8a98e39d3df6 Mon Sep 17 00:00:00 2001 From: veetaha Date: Sun, 10 May 2020 19:11:22 +0300 Subject: [PATCH] Remove MacroStmts as per edwin0cheng --- crates/ra_syntax/src/ast/generated/nodes.rs | 32 --------------------- xtask/src/ast_src.rs | 15 ---------- 2 files changed, 47 deletions(-) diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 4bcdbd495d..7de20bff78 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -2469,22 +2469,6 @@ pub struct MacroItems { } impl ast::ModuleItemOwner for MacroItems {} impl MacroItems {} -/// Macro statements is a node that holds an statements created by expanding a macro. -/// -/// ``` -/// foo!(); // expands into some statements -v -/// // ❰ foo_crate::bar(); ❱ -/// ``` -/// -/// [Reference](https://doc.rust-lang.org/reference/macros.html) -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroStmts { - pub(crate) syntax: SyntaxNode, -} -impl MacroStmts { - pub fn statements(&self) -> AstChildren { support::children(&self.syntax) } - pub fn expr(&self) -> Option { support::child(&self.syntax) } -} /// List of items in an extern block. /// /// ``` @@ -4041,17 +4025,6 @@ impl AstNode for MacroItems { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroStmts { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } - 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 ExternItemList { fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } fn cast(syntax: SyntaxNode) -> Option { @@ -5484,11 +5457,6 @@ impl std::fmt::Display for MacroItems { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroStmts { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for ExternItemList { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 47a5d1d91d..ab50eee367 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -2010,21 +2010,6 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { /// [Reference](https://doc.rust-lang.org/reference/macros.html) struct MacroItems: ModuleItemOwner { } - // TODO: Idk what I am writing here, please don't believe these words. - // TODO: clarify @matklad @edwin0cheng - /// Macro statements is a node that holds an statements created by expanding a macro. - /// - /// ``` - /// foo!(); // expands into some statements -v - /// // ❰ foo_crate::bar(); ❱ - /// ``` - /// - /// [Reference](https://doc.rust-lang.org/reference/macros.html) - struct MacroStmts { - statements: [Stmt], - Expr, - } - /// List of items in an extern block. /// /// ```