From 572f1c08b6ba43bdd57c5cb99f79a08ecd821c1c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 19:49:26 +0200 Subject: Minor gramamr reorder --- crates/ra_syntax/src/ast/generated/nodes.rs | 659 ++++++++++++++-------------- 1 file changed, 328 insertions(+), 331 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 6ce9c4adc..66821a31c 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -6,6 +6,20 @@ use crate::{ SyntaxNode, SyntaxToken, T, }; #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Name { + pub(crate) syntax: SyntaxNode, +} +impl Name { + pub fn ident_token(&self) -> Option { support::token(&self.syntax, T![ident]) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct NameRef { + pub(crate) syntax: SyntaxNode, +} +impl NameRef { + pub fn ident_token(&self) -> Option { support::token(&self.syntax, T![ident]) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Path { pub(crate) syntax: SyntaxNode, } @@ -33,13 +47,6 @@ impl PathSegment { pub fn r_angle_token(&self) -> Option { support::token(&self.syntax, T![>]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct NameRef { - pub(crate) syntax: SyntaxNode, -} -impl NameRef { - pub fn ident_token(&self) -> Option { support::token(&self.syntax, T![ident]) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct GenericArgList { pub(crate) syntax: SyntaxNode, } @@ -116,13 +123,16 @@ impl TypeBoundList { pub fn bounds(&self) -> AstChildren { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SourceFile { +pub struct MacroCall { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for SourceFile {} -impl ast::ModuleItemOwner for SourceFile {} -impl SourceFile { - pub fn shebang_token(&self) -> Option { support::token(&self.syntax, T![shebang]) } +impl ast::AttrsOwner for MacroCall {} +impl ast::NameOwner for MacroCall {} +impl MacroCall { + pub fn path(&self) -> Option { support::child(&self.syntax) } + pub fn excl_token(&self) -> Option { support::token(&self.syntax, T![!]) } + pub fn token_tree(&self) -> Option { support::child(&self.syntax) } + pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Attr { @@ -139,6 +149,41 @@ impl Attr { pub fn r_brack_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 MacroItems { + pub(crate) syntax: SyntaxNode, +} +impl ast::ModuleItemOwner for MacroItems {} +impl MacroItems {} +#[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) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct SourceFile { + pub(crate) syntax: SyntaxNode, +} +impl ast::AttrsOwner for SourceFile {} +impl ast::ModuleItemOwner for SourceFile {} +impl SourceFile { + pub fn shebang_token(&self) -> Option { support::token(&self.syntax, T![shebang]) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Const { pub(crate) syntax: SyntaxNode, } @@ -228,18 +273,6 @@ impl Impl { pub fn assoc_item_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroCall { - pub(crate) syntax: SyntaxNode, -} -impl ast::AttrsOwner for MacroCall {} -impl ast::NameOwner for MacroCall {} -impl MacroCall { - pub fn path(&self) -> Option { support::child(&self.syntax) } - pub fn excl_token(&self) -> Option { support::token(&self.syntax, T![!]) } - pub fn token_tree(&self) -> Option { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Module { pub(crate) syntax: SyntaxNode, } @@ -349,13 +382,6 @@ impl Visibility { pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Name { - pub(crate) syntax: SyntaxNode, -} -impl Name { - pub fn ident_token(&self) -> Option { support::token(&self.syntax, T![ident]) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ItemList { pub(crate) syntax: SyntaxNode, } @@ -589,18 +615,6 @@ pub struct Literal { impl ast::AttrsOwner for Literal {} 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 ExprStmt { pub(crate) syntax: SyntaxNode, } @@ -1097,28 +1111,15 @@ impl TypeBound { pub fn ty(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct OrPat { - pub(crate) syntax: SyntaxNode, -} -impl OrPat { - pub fn pats(&self) -> AstChildren { support::children(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParenPat { - pub(crate) syntax: SyntaxNode, -} -impl ParenPat { - pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } - pub fn pat(&self) -> Option { support::child(&self.syntax) } - pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RefPat { +pub struct BindPat { pub(crate) syntax: SyntaxNode, } -impl RefPat { - pub fn amp_token(&self) -> Option { support::token(&self.syntax, T![&]) } +impl ast::AttrsOwner for BindPat {} +impl ast::NameOwner for BindPat {} +impl BindPat { + pub fn ref_token(&self) -> Option { support::token(&self.syntax, T![ref]) } pub fn mut_token(&self) -> Option { support::token(&self.syntax, T![mut]) } + pub fn at_token(&self) -> Option { support::token(&self.syntax, T![@]) } pub fn pat(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -1130,69 +1131,61 @@ impl BoxPat { pub fn path(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BindPat { +pub struct DotDotPat { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for BindPat {} -impl ast::NameOwner for BindPat {} -impl BindPat { - pub fn ref_token(&self) -> Option { support::token(&self.syntax, T![ref]) } - pub fn mut_token(&self) -> Option { support::token(&self.syntax, T![mut]) } - pub fn at_token(&self) -> Option { support::token(&self.syntax, T![@]) } - pub fn pat(&self) -> Option { support::child(&self.syntax) } +impl DotDotPat { + pub fn dotdot_token(&self) -> Option { support::token(&self.syntax, T![..]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PlaceholderPat { +pub struct LiteralPat { pub(crate) syntax: SyntaxNode, } -impl PlaceholderPat { - pub fn underscore_token(&self) -> Option { support::token(&self.syntax, T![_]) } +impl LiteralPat { + pub fn literal(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct DotDotPat { +pub struct MacroPat { pub(crate) syntax: SyntaxNode, } -impl DotDotPat { - pub fn dotdot_token(&self) -> Option { support::token(&self.syntax, T![..]) } +impl MacroPat { + pub fn macro_call(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathPat { +pub struct OrPat { pub(crate) syntax: SyntaxNode, } -impl PathPat { - pub fn path(&self) -> Option { support::child(&self.syntax) } +impl OrPat { + pub fn pats(&self) -> AstChildren { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SlicePat { +pub struct ParenPat { pub(crate) syntax: SyntaxNode, } -impl SlicePat { - pub fn l_brack_token(&self) -> Option { support::token(&self.syntax, T!['[']) } - pub fn args(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_brack_token(&self) -> Option { support::token(&self.syntax, T![']']) } +impl ParenPat { + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } + pub fn pat(&self) -> Option { support::child(&self.syntax) } + pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RangePat { +pub struct PathPat { pub(crate) syntax: SyntaxNode, } -impl RangePat { - pub fn dotdot_token(&self) -> Option { support::token(&self.syntax, T![..]) } - pub fn dotdoteq_token(&self) -> Option { support::token(&self.syntax, T![..=]) } +impl PathPat { + pub fn path(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LiteralPat { +pub struct PlaceholderPat { pub(crate) syntax: SyntaxNode, } -impl LiteralPat { - pub fn literal(&self) -> Option { support::child(&self.syntax) } +impl PlaceholderPat { + pub fn underscore_token(&self) -> Option { support::token(&self.syntax, T![_]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroPat { +pub struct RangePat { pub(crate) syntax: SyntaxNode, } -impl MacroPat { - pub fn macro_call(&self) -> Option { support::child(&self.syntax) } -} +impl RangePat {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordPat { pub(crate) syntax: SyntaxNode, @@ -1204,60 +1197,64 @@ impl RecordPat { } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldPatList { +pub struct RefPat { pub(crate) syntax: SyntaxNode, } -impl RecordFieldPatList { - pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } - pub fn record_field_pats(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn bind_pats(&self) -> AstChildren { support::children(&self.syntax) } - pub fn dotdot_token(&self) -> Option { support::token(&self.syntax, T![..]) } - pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } +impl RefPat { + pub fn amp_token(&self) -> Option { support::token(&self.syntax, T![&]) } + pub fn mut_token(&self) -> Option { support::token(&self.syntax, T![mut]) } + pub fn pat(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldPat { +pub struct SlicePat { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for RecordFieldPat {} -impl RecordFieldPat { - pub fn name_ref(&self) -> Option { support::child(&self.syntax) } - pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } - pub fn pat(&self) -> Option { support::child(&self.syntax) } +impl SlicePat { + pub fn l_brack_token(&self) -> Option { support::token(&self.syntax, T!['[']) } + pub fn args(&self) -> AstChildren { support::children(&self.syntax) } + pub fn r_brack_token(&self) -> Option { support::token(&self.syntax, T![']']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleStructPat { +pub struct TuplePat { pub(crate) syntax: SyntaxNode, } -impl TupleStructPat { - pub fn path(&self) -> Option { support::child(&self.syntax) } +impl TuplePat { pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } pub fn args(&self) -> AstChildren { support::children(&self.syntax) } pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TuplePat { +pub struct TupleStructPat { pub(crate) syntax: SyntaxNode, } -impl TuplePat { +impl TupleStructPat { + pub fn path(&self) -> Option { support::child(&self.syntax) } pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } pub fn args(&self) -> AstChildren { support::children(&self.syntax) } pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroItems { +pub struct RecordFieldPatList { pub(crate) syntax: SyntaxNode, } -impl ast::ModuleItemOwner for MacroItems {} -impl MacroItems {} +impl RecordFieldPatList { + pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } + pub fn record_field_pats(&self) -> AstChildren { + support::children(&self.syntax) + } + pub fn bind_pats(&self) -> AstChildren { support::children(&self.syntax) } + pub fn dotdot_token(&self) -> Option { support::token(&self.syntax, T![..]) } + pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } +} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroStmts { +pub struct RecordFieldPat { pub(crate) syntax: SyntaxNode, } -impl MacroStmts { - pub fn statements(&self) -> AstChildren { support::children(&self.syntax) } - pub fn expr(&self) -> Option { support::child(&self.syntax) } +impl ast::AttrsOwner for RecordFieldPat {} +impl RecordFieldPat { + pub fn name_ref(&self) -> Option { support::child(&self.syntax) } + pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } + pub fn pat(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum GenericArg { @@ -1334,22 +1331,28 @@ pub enum Item { } impl ast::AttrsOwner for Item {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum Stmt { + ExprStmt(ExprStmt), + Item(Item), + LetStmt(LetStmt), +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Pat { - OrPat(OrPat), - ParenPat(ParenPat), - RefPat(RefPat), - BoxPat(BoxPat), BindPat(BindPat), - PlaceholderPat(PlaceholderPat), + BoxPat(BoxPat), DotDotPat(DotDotPat), + LiteralPat(LiteralPat), + MacroPat(MacroPat), + OrPat(OrPat), + ParenPat(ParenPat), PathPat(PathPat), + PlaceholderPat(PlaceholderPat), + RangePat(RangePat), RecordPat(RecordPat), - TupleStructPat(TupleStructPat), - TuplePat(TuplePat), + RefPat(RefPat), SlicePat(SlicePat), - RangePat(RangePat), - LiteralPat(LiteralPat), - MacroPat(MacroPat), + TuplePat(TuplePat), + TupleStructPat(TupleStructPat), } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum FieldList { @@ -1390,14 +1393,19 @@ pub enum GenericParam { TypeParam(TypeParam), } impl ast::AttrsOwner for GenericParam {} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Stmt { - ExprStmt(ExprStmt), - Item(Item), - LetStmt(LetStmt), +impl AstNode for Name { + fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } + 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 Path { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } +impl AstNode for NameRef { + fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1407,8 +1415,8 @@ impl AstNode for Path { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PathSegment { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } +impl AstNode for Path { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1418,8 +1426,8 @@ impl AstNode for PathSegment { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for NameRef { - fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } +impl AstNode for PathSegment { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1528,8 +1536,8 @@ impl AstNode for TypeBoundList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for SourceFile { - fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } +impl AstNode for MacroCall { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1550,6 +1558,50 @@ impl AstNode for Attr { } 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 MacroItems { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } + 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 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 SourceFile { + fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } + 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 Const { fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } fn cast(syntax: SyntaxNode) -> Option { @@ -1616,17 +1668,6 @@ impl AstNode for Impl { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroCall { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } - 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 Module { fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } fn cast(syntax: SyntaxNode) -> Option { @@ -1715,17 +1756,6 @@ impl AstNode for Visibility { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Name { - fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } - 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 ItemList { fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } fn cast(syntax: SyntaxNode) -> Option { @@ -1979,17 +2009,6 @@ impl AstNode for Literal { } 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 ExprStmt { fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } fn cast(syntax: SyntaxNode) -> Option { @@ -2529,30 +2548,8 @@ impl AstNode for TupleType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeBound { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } - 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 OrPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } - 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 ParenPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } +impl AstNode for TypeBound { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2562,8 +2559,8 @@ impl AstNode for ParenPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RefPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } +impl AstNode for BindPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2584,8 +2581,8 @@ impl AstNode for BoxPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for BindPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } +impl AstNode for DotDotPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2595,8 +2592,8 @@ impl AstNode for BindPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PlaceholderPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } +impl AstNode for LiteralPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2606,8 +2603,8 @@ impl AstNode for PlaceholderPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for DotDotPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } +impl AstNode for MacroPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2617,8 +2614,8 @@ impl AstNode for DotDotPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PathPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } +impl AstNode for OrPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2628,8 +2625,8 @@ impl AstNode for PathPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for SlicePat { - fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } +impl AstNode for ParenPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2639,8 +2636,8 @@ impl AstNode for SlicePat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RangePat { - fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } +impl AstNode for PathPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2650,8 +2647,8 @@ impl AstNode for RangePat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LiteralPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } +impl AstNode for PlaceholderPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2661,8 +2658,8 @@ impl AstNode for LiteralPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } +impl AstNode for RangePat { + fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2683,8 +2680,8 @@ impl AstNode for RecordPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldPatList { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } +impl AstNode for RefPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2694,8 +2691,8 @@ impl AstNode for RecordFieldPatList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } +impl AstNode for SlicePat { + fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2705,8 +2702,8 @@ impl AstNode for RecordFieldPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TupleStructPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } +impl AstNode for TuplePat { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2716,8 +2713,8 @@ impl AstNode for TupleStructPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TuplePat { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } +impl AstNode for TupleStructPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2727,8 +2724,8 @@ impl AstNode for TuplePat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroItems { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } +impl AstNode for RecordFieldPatList { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2738,8 +2735,8 @@ impl AstNode for MacroItems { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroStmts { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } +impl AstNode for RecordFieldPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3133,98 +3130,107 @@ impl AstNode for Item { } } } -impl From for Pat { - fn from(node: OrPat) -> Pat { Pat::OrPat(node) } -} -impl From for Pat { - fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) } +impl From for Stmt { + fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } } -impl From for Pat { - fn from(node: RefPat) -> Pat { Pat::RefPat(node) } +impl From for Stmt { + fn from(node: Item) -> Stmt { Stmt::Item(node) } } -impl From for Pat { - fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } +impl From for Stmt { + fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } } impl From for Pat { fn from(node: BindPat) -> Pat { Pat::BindPat(node) } } -impl From for Pat { - fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } +impl From for Pat { + fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } } impl From for Pat { fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) } } +impl From for Pat { + fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) } +} +impl From for Pat { + fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } +} +impl From for Pat { + fn from(node: OrPat) -> Pat { Pat::OrPat(node) } +} +impl From for Pat { + fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) } +} impl From for Pat { fn from(node: PathPat) -> Pat { Pat::PathPat(node) } } +impl From for Pat { + fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } +} +impl From for Pat { + fn from(node: RangePat) -> Pat { Pat::RangePat(node) } +} impl From for Pat { fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) } } -impl From for Pat { - fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } -} -impl From for Pat { - fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) } +impl From for Pat { + fn from(node: RefPat) -> Pat { Pat::RefPat(node) } } impl From for Pat { fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) } } -impl From for Pat { - fn from(node: RangePat) -> Pat { Pat::RangePat(node) } -} -impl From for Pat { - fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) } +impl From for Pat { + fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) } } -impl From for Pat { - fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } +impl From for Pat { + fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } } impl AstNode for Pat { fn can_cast(kind: SyntaxKind) -> bool { match kind { - OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT - | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT - | LITERAL_PAT | MACRO_PAT => true, + BIND_PAT | BOX_PAT | DOT_DOT_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT + | PATH_PAT | PLACEHOLDER_PAT | RANGE_PAT | RECORD_PAT | REF_PAT | SLICE_PAT + | TUPLE_PAT | TUPLE_STRUCT_PAT => true, _ => false, } } fn cast(syntax: SyntaxNode) -> Option { let res = match syntax.kind() { - OR_PAT => Pat::OrPat(OrPat { syntax }), - PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), - REF_PAT => Pat::RefPat(RefPat { syntax }), - BOX_PAT => Pat::BoxPat(BoxPat { syntax }), BIND_PAT => Pat::BindPat(BindPat { syntax }), - PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), + BOX_PAT => Pat::BoxPat(BoxPat { syntax }), DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }), + LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), + MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), + OR_PAT => Pat::OrPat(OrPat { syntax }), + PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), PATH_PAT => Pat::PathPat(PathPat { syntax }), + PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), + RANGE_PAT => Pat::RangePat(RangePat { syntax }), RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), - TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), - TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), + REF_PAT => Pat::RefPat(RefPat { syntax }), SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), - RANGE_PAT => Pat::RangePat(RangePat { syntax }), - LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), - MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), + TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), + TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - Pat::OrPat(it) => &it.syntax, - Pat::ParenPat(it) => &it.syntax, - Pat::RefPat(it) => &it.syntax, - Pat::BoxPat(it) => &it.syntax, Pat::BindPat(it) => &it.syntax, - Pat::PlaceholderPat(it) => &it.syntax, + Pat::BoxPat(it) => &it.syntax, Pat::DotDotPat(it) => &it.syntax, + Pat::LiteralPat(it) => &it.syntax, + Pat::MacroPat(it) => &it.syntax, + Pat::OrPat(it) => &it.syntax, + Pat::ParenPat(it) => &it.syntax, Pat::PathPat(it) => &it.syntax, + Pat::PlaceholderPat(it) => &it.syntax, + Pat::RangePat(it) => &it.syntax, Pat::RecordPat(it) => &it.syntax, - Pat::TupleStructPat(it) => &it.syntax, - Pat::TuplePat(it) => &it.syntax, + Pat::RefPat(it) => &it.syntax, Pat::SlicePat(it) => &it.syntax, - Pat::RangePat(it) => &it.syntax, - Pat::LiteralPat(it) => &it.syntax, - Pat::MacroPat(it) => &it.syntax, + Pat::TuplePat(it) => &it.syntax, + Pat::TupleStructPat(it) => &it.syntax, } } } @@ -3393,15 +3399,6 @@ impl AstNode for GenericParam { } } } -impl From for Stmt { - fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } -} -impl From for Stmt { - fn from(node: Item) -> Stmt { Stmt::Item(node) } -} -impl From for Stmt { - fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } -} impl std::fmt::Display for GenericArg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3422,6 +3419,11 @@ impl std::fmt::Display for Item { std::fmt::Display::fmt(self.syntax(), f) } } +impl std::fmt::Display for Stmt { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} impl std::fmt::Display for Pat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3452,22 +3454,22 @@ impl std::fmt::Display for GenericParam { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Stmt { +impl std::fmt::Display for Name { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Path { +impl std::fmt::Display for NameRef { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PathSegment { +impl std::fmt::Display for Path { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for NameRef { +impl std::fmt::Display for PathSegment { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -3517,7 +3519,7 @@ impl std::fmt::Display for TypeBoundList { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for SourceFile { +impl std::fmt::Display for MacroCall { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -3527,6 +3529,26 @@ impl std::fmt::Display for Attr { 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 MacroItems { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + 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 SourceFile { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} impl std::fmt::Display for Const { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3557,11 +3579,6 @@ impl std::fmt::Display for Impl { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroCall { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for Module { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3602,11 +3619,6 @@ impl std::fmt::Display for Visibility { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Name { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for ItemList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3722,11 +3734,6 @@ impl std::fmt::Display for Literal { 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 ExprStmt { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3977,37 +3984,37 @@ impl std::fmt::Display for TypeBound { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for OrPat { +impl std::fmt::Display for BindPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ParenPat { +impl std::fmt::Display for BoxPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RefPat { +impl std::fmt::Display for DotDotPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BoxPat { +impl std::fmt::Display for LiteralPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BindPat { +impl std::fmt::Display for MacroPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PlaceholderPat { +impl std::fmt::Display for OrPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for DotDotPat { +impl std::fmt::Display for ParenPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -4017,7 +4024,7 @@ impl std::fmt::Display for PathPat { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for SlicePat { +impl std::fmt::Display for PlaceholderPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -4027,47 +4034,37 @@ impl std::fmt::Display for RangePat { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LiteralPat { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl std::fmt::Display for MacroPat { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for RecordPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldPatList { +impl std::fmt::Display for RefPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldPat { +impl std::fmt::Display for SlicePat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleStructPat { +impl std::fmt::Display for TuplePat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TuplePat { +impl std::fmt::Display for TupleStructPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroItems { +impl std::fmt::Display for RecordFieldPatList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroStmts { +impl std::fmt::Display for RecordFieldPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } -- cgit v1.2.3