From 54fd09a9ca567fc79cae53237dfeedc5baeec635 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 18:27:23 +0200 Subject: Finalize Path grammar --- crates/ra_syntax/src/ast/generated/nodes.rs | 923 ++++++++++++++-------------- 1 file changed, 462 insertions(+), 461 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 e049548c9..1a707ad67 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -6,6 +6,137 @@ use crate::{ SyntaxNode, SyntaxToken, T, }; #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Path { + pub(crate) syntax: SyntaxNode, +} +impl Path { + pub fn qualifier(&self) -> Option { support::child(&self.syntax) } + pub fn coloncolon_token(&self) -> Option { support::token(&self.syntax, T![::]) } + pub fn segment(&self) -> Option { support::child(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct PathSegment { + pub(crate) syntax: SyntaxNode, +} +impl PathSegment { + pub fn coloncolon_token(&self) -> Option { support::token(&self.syntax, T![::]) } + pub fn crate_token(&self) -> Option { support::token(&self.syntax, T![crate]) } + pub fn self_token(&self) -> Option { support::token(&self.syntax, T![self]) } + pub fn super_token(&self) -> Option { support::token(&self.syntax, T![super]) } + pub fn name_ref(&self) -> Option { support::child(&self.syntax) } + pub fn type_arg_list(&self) -> Option { support::child(&self.syntax) } + pub fn param_list(&self) -> Option { support::child(&self.syntax) } + pub fn ret_type(&self) -> Option { support::child(&self.syntax) } + pub fn l_angle_token(&self) -> Option { support::token(&self.syntax, T![<]) } + pub fn path_type(&self) -> Option { support::child(&self.syntax) } + pub fn as_token(&self) -> Option { support::token(&self.syntax, T![as]) } + 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 TypeArgList { + pub(crate) syntax: SyntaxNode, +} +impl TypeArgList { + pub fn coloncolon_token(&self) -> Option { support::token(&self.syntax, T![::]) } + pub fn l_angle_token(&self) -> Option { support::token(&self.syntax, T![<]) } + pub fn type_args(&self) -> AstChildren { support::children(&self.syntax) } + pub fn lifetime_args(&self) -> AstChildren { support::children(&self.syntax) } + pub fn assoc_type_args(&self) -> AstChildren { support::children(&self.syntax) } + pub fn const_args(&self) -> AstChildren { support::children(&self.syntax) } + pub fn r_angle_token(&self) -> Option { support::token(&self.syntax, T![>]) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct ParamList { + pub(crate) syntax: SyntaxNode, +} +impl ParamList { + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } + pub fn self_param(&self) -> Option { support::child(&self.syntax) } + pub fn comma_token(&self) -> Option { support::token(&self.syntax, T![,]) } + pub fn params(&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 RetType { + pub(crate) syntax: SyntaxNode, +} +impl RetType { + pub fn thin_arrow_token(&self) -> Option { support::token(&self.syntax, T![->]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct PathType { + pub(crate) syntax: SyntaxNode, +} +impl PathType { + pub fn path(&self) -> Option { support::child(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct TypeArg { + pub(crate) syntax: SyntaxNode, +} +impl TypeArg { + pub fn ty(&self) -> Option { support::child(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct LifetimeArg { + pub(crate) syntax: SyntaxNode, +} +impl LifetimeArg { + pub fn lifetime_token(&self) -> Option { + support::token(&self.syntax, T![lifetime]) + } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct AssocTypeArg { + pub(crate) syntax: SyntaxNode, +} +impl ast::TypeBoundsOwner for AssocTypeArg {} +impl AssocTypeArg { + pub fn name_ref(&self) -> Option { support::child(&self.syntax) } + pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } + pub fn ty(&self) -> Option { support::child(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct ConstArg { + pub(crate) syntax: SyntaxNode, +} +impl ConstArg { + pub fn literal(&self) -> Option { support::child(&self.syntax) } + pub fn block_expr(&self) -> Option { support::child(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct TypeBoundList { + pub(crate) syntax: SyntaxNode, +} +impl TypeBoundList { + pub fn bounds(&self) -> AstChildren { support::children(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Literal { + pub(crate) syntax: SyntaxNode, +} +impl ast::AttrsOwner for Literal {} +impl Literal {} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct BlockExpr { + pub(crate) syntax: SyntaxNode, +} +impl ast::AttrsOwner for BlockExpr {} +impl BlockExpr { + pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } + pub fn statements(&self) -> AstChildren { support::children(&self.syntax) } + pub fn expr(&self) -> Option { support::child(&self.syntax) } + pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SourceFile { pub(crate) syntax: SyntaxNode, } @@ -256,13 +387,6 @@ impl ItemList { pub fn r_curly_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 Rename { pub(crate) syntax: SyntaxNode, } @@ -283,15 +407,6 @@ impl UseTree { pub fn rename(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Path { - pub(crate) syntax: SyntaxNode, -} -impl Path { - pub fn qualifier(&self) -> Option { support::child(&self.syntax) } - pub fn coloncolon_token(&self) -> Option { support::token(&self.syntax, T![::]) } - pub fn segment(&self) -> Option { support::child(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct UseTreeList { pub(crate) syntax: SyntaxNode, } @@ -317,25 +432,6 @@ impl GenericParamList { pub fn r_angle_token(&self) -> Option { support::token(&self.syntax, T![>]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParamList { - pub(crate) syntax: SyntaxNode, -} -impl ParamList { - pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } - pub fn self_param(&self) -> Option { support::child(&self.syntax) } - pub fn comma_token(&self) -> Option { support::token(&self.syntax, T![,]) } - pub fn params(&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 RetType { - pub(crate) syntax: SyntaxNode, -} -impl RetType { - pub fn thin_arrow_token(&self) -> Option { support::token(&self.syntax, T![->]) } - pub fn ty(&self) -> Option { support::child(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WhereClause { pub(crate) syntax: SyntaxNode, } @@ -344,17 +440,6 @@ impl WhereClause { pub fn predicates(&self) -> AstChildren { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BlockExpr { - pub(crate) syntax: SyntaxNode, -} -impl ast::AttrsOwner for BlockExpr {} -impl BlockExpr { - pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } - pub fn statements(&self) -> AstChildren { support::children(&self.syntax) } - pub fn expr(&self) -> Option { support::child(&self.syntax) } - pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SelfParam { pub(crate) syntax: SyntaxNode, } @@ -381,13 +466,6 @@ impl Param { pub fn dotdotdot_token(&self) -> Option { support::token(&self.syntax, T![...]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeBoundList { - pub(crate) syntax: SyntaxNode, -} -impl TypeBoundList { - pub fn bounds(&self) -> AstChildren { support::children(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordFieldList { pub(crate) syntax: SyntaxNode, } @@ -515,12 +593,6 @@ impl WherePred { pub fn ty(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Literal { - pub(crate) syntax: SyntaxNode, -} -impl ast::AttrsOwner for Literal {} -impl Literal {} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TokenTree { pub(crate) syntax: SyntaxNode, } @@ -866,19 +938,6 @@ impl ArgList { pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeArgList { - pub(crate) syntax: SyntaxNode, -} -impl TypeArgList { - pub fn coloncolon_token(&self) -> Option { support::token(&self.syntax, T![::]) } - pub fn l_angle_token(&self) -> Option { support::token(&self.syntax, T![<]) } - pub fn type_args(&self) -> AstChildren { support::children(&self.syntax) } - pub fn lifetime_args(&self) -> AstChildren { support::children(&self.syntax) } - pub fn assoc_type_args(&self) -> AstChildren { support::children(&self.syntax) } - pub fn const_args(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_angle_token(&self) -> Option { support::token(&self.syntax, T![>]) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Condition { pub(crate) syntax: SyntaxNode, } @@ -991,13 +1050,6 @@ impl ParenType { pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathType { - pub(crate) syntax: SyntaxNode, -} -impl PathType { - pub fn path(&self) -> Option { support::child(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PointerType { pub(crate) syntax: SyntaxNode, } @@ -1220,91 +1272,40 @@ impl MacroStmts { pub fn expr(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathSegment { - pub(crate) syntax: SyntaxNode, -} -impl PathSegment { - pub fn coloncolon_token(&self) -> Option { support::token(&self.syntax, T![::]) } - pub fn crate_token(&self) -> Option { support::token(&self.syntax, T![crate]) } - pub fn self_token(&self) -> Option { support::token(&self.syntax, T![self]) } - pub fn super_token(&self) -> Option { support::token(&self.syntax, T![super]) } - pub fn l_angle_token(&self) -> Option { support::token(&self.syntax, T![<]) } - pub fn name_ref(&self) -> Option { support::child(&self.syntax) } - pub fn type_arg_list(&self) -> Option { support::child(&self.syntax) } - pub fn param_list(&self) -> Option { support::child(&self.syntax) } - pub fn ret_type(&self) -> Option { support::child(&self.syntax) } - pub fn path_type(&self) -> Option { support::child(&self.syntax) } - pub fn r_angle_token(&self) -> Option { support::token(&self.syntax, T![>]) } +pub enum Type { + ArrayType(ArrayType), + DynTraitType(DynTraitType), + FnPointerType(FnPointerType), + ForType(ForType), + ImplTraitType(ImplTraitType), + InferType(InferType), + NeverType(NeverType), + ParenType(ParenType), + PathType(PathType), + PointerType(PointerType), + ReferenceType(ReferenceType), + SliceType(SliceType), + TupleType(TupleType), } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeArg { - pub(crate) syntax: SyntaxNode, -} -impl TypeArg { - pub fn ty(&self) -> Option { support::child(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LifetimeArg { - pub(crate) syntax: SyntaxNode, -} -impl LifetimeArg { - pub fn lifetime_token(&self) -> Option { - support::token(&self.syntax, T![lifetime]) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AssocTypeArg { - pub(crate) syntax: SyntaxNode, -} -impl ast::TypeBoundsOwner for AssocTypeArg {} -impl AssocTypeArg { - pub fn name_ref(&self) -> Option { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } - pub fn ty(&self) -> Option { support::child(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ConstArg { - pub(crate) syntax: SyntaxNode, -} -impl ConstArg { - pub fn literal(&self) -> Option { support::child(&self.syntax) } - pub fn block_expr(&self) -> Option { support::child(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Item { - Const(Const), - Enum(Enum), - ExternBlock(ExternBlock), - ExternCrate(ExternCrate), - Fn(Fn), - Impl(Impl), - MacroCall(MacroCall), - Module(Module), - Static(Static), - Struct(Struct), - Trait(Trait), - TypeAlias(TypeAlias), - Union(Union), - Use(Use), +pub enum Item { + Const(Const), + Enum(Enum), + ExternBlock(ExternBlock), + ExternCrate(ExternCrate), + Fn(Fn), + Impl(Impl), + MacroCall(MacroCall), + Module(Module), + Static(Static), + Struct(Struct), + Trait(Trait), + TypeAlias(TypeAlias), + Union(Union), + Use(Use), } impl ast::AttrsOwner for Item {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Type { - ArrayType(ArrayType), - DynTraitType(DynTraitType), - FnPointerType(FnPointerType), - ForType(ForType), - ImplTraitType(ImplTraitType), - InferType(InferType), - NeverType(NeverType), - ParenType(ParenType), - PathType(PathType), - PointerType(PointerType), - ReferenceType(ReferenceType), - SliceType(SliceType), - TupleType(TupleType), -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Pat { OrPat(OrPat), ParenPat(ParenPat), @@ -1400,8 +1401,8 @@ pub enum Stmt { Item(Item), LetStmt(LetStmt), } -impl AstNode for SourceFile { - fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } +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 }) @@ -1411,8 +1412,8 @@ impl AstNode for SourceFile { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Attr { - fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } +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 }) @@ -1422,8 +1423,8 @@ impl AstNode for Attr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Const { - fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } +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 }) @@ -1433,8 +1434,8 @@ impl AstNode for Const { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Enum { - fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } +impl AstNode for TypeArgList { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1444,8 +1445,8 @@ impl AstNode for Enum { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ExternBlock { - fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } +impl AstNode for ParamList { + fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1455,8 +1456,8 @@ impl AstNode for ExternBlock { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ExternCrate { - fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } +impl AstNode for RetType { + fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1466,8 +1467,8 @@ impl AstNode for ExternCrate { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Fn { - fn can_cast(kind: SyntaxKind) -> bool { kind == FN } +impl AstNode for PathType { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1477,8 +1478,8 @@ impl AstNode for Fn { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Impl { - fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } +impl AstNode for TypeArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1488,8 +1489,8 @@ impl AstNode for Impl { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroCall { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } +impl AstNode for LifetimeArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1499,8 +1500,8 @@ impl AstNode for MacroCall { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Module { - fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } +impl AstNode for AssocTypeArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1510,8 +1511,8 @@ impl AstNode for Module { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Static { - fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } +impl AstNode for ConstArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1521,8 +1522,8 @@ impl AstNode for Static { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Struct { - fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } +impl AstNode for TypeBoundList { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1532,8 +1533,8 @@ impl AstNode for Struct { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Trait { - fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } +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 }) @@ -1543,8 +1544,8 @@ impl AstNode for Trait { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeAlias { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } +impl AstNode for BlockExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1554,8 +1555,8 @@ impl AstNode for TypeAlias { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Union { - fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } +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 }) @@ -1565,8 +1566,8 @@ impl AstNode for Union { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Use { - fn can_cast(kind: SyntaxKind) -> bool { kind == USE } +impl AstNode for Attr { + fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1576,8 +1577,8 @@ impl AstNode for Use { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Visibility { - fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } +impl AstNode for Const { + fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1587,8 +1588,8 @@ impl AstNode for Visibility { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Name { - fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } +impl AstNode for Enum { + fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1598,8 +1599,8 @@ impl AstNode for Name { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ItemList { - fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } +impl AstNode for ExternBlock { + fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1609,8 +1610,8 @@ impl AstNode for ItemList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for NameRef { - fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } +impl AstNode for ExternCrate { + fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1620,8 +1621,8 @@ impl AstNode for NameRef { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Rename { - fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } +impl AstNode for Fn { + fn can_cast(kind: SyntaxKind) -> bool { kind == FN } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1631,8 +1632,8 @@ impl AstNode for Rename { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for UseTree { - fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } +impl AstNode for Impl { + fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1642,8 +1643,8 @@ impl AstNode for UseTree { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Path { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } +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 }) @@ -1653,8 +1654,8 @@ impl AstNode for Path { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for UseTreeList { - fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } +impl AstNode for Module { + fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1664,8 +1665,8 @@ impl AstNode for UseTreeList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Abi { - fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } +impl AstNode for Static { + fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1675,8 +1676,8 @@ impl AstNode for Abi { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for GenericParamList { - fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } +impl AstNode for Struct { + fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1686,8 +1687,8 @@ impl AstNode for GenericParamList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ParamList { - fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } +impl AstNode for Trait { + fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1697,8 +1698,8 @@ impl AstNode for ParamList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RetType { - fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } +impl AstNode for TypeAlias { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1708,8 +1709,8 @@ impl AstNode for RetType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for WhereClause { - fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } +impl AstNode for Union { + fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1719,8 +1720,8 @@ impl AstNode for WhereClause { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for BlockExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } +impl AstNode for Use { + fn can_cast(kind: SyntaxKind) -> bool { kind == USE } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1730,8 +1731,8 @@ impl AstNode for BlockExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for SelfParam { - fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } +impl AstNode for Visibility { + fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1741,8 +1742,8 @@ impl AstNode for SelfParam { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Param { - fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } +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 }) @@ -1752,8 +1753,96 @@ impl AstNode for Param { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeBoundList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } +impl AstNode for ItemList { + fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } + 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 Rename { + fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } + 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 UseTree { + fn can_cast(kind: SyntaxKind) -> bool { kind == USE_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 UseTreeList { + fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } + 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 Abi { + fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } + 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 GenericParamList { + fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } + 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 WhereClause { + fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } + 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 SelfParam { + fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } + 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 Param { + fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1895,17 +1984,6 @@ impl AstNode for WherePred { } 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 { @@ -2280,17 +2358,6 @@ impl AstNode for ArgList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeArgList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } - 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 Condition { fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } fn cast(syntax: SyntaxNode) -> Option { @@ -2423,17 +2490,6 @@ impl AstNode for ParenType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PathType { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } - 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 PointerType { fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } fn cast(syntax: SyntaxNode) -> Option { @@ -2709,60 +2765,90 @@ impl AstNode for MacroStmts { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -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 }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { &self.syntax } +impl From for Type { + fn from(node: ArrayType) -> Type { Type::ArrayType(node) } } -impl AstNode for TypeArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } - 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 Type { + fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } } -impl AstNode for LifetimeArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None +impl From for Type { + fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) } +} +impl From for Type { + fn from(node: ForType) -> Type { Type::ForType(node) } +} +impl From for Type { + fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) } +} +impl From for Type { + fn from(node: InferType) -> Type { Type::InferType(node) } +} +impl From for Type { + fn from(node: NeverType) -> Type { Type::NeverType(node) } +} +impl From for Type { + fn from(node: ParenType) -> Type { Type::ParenType(node) } +} +impl From for Type { + fn from(node: PathType) -> Type { Type::PathType(node) } +} +impl From for Type { + fn from(node: PointerType) -> Type { Type::PointerType(node) } +} +impl From for Type { + fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) } +} +impl From for Type { + fn from(node: SliceType) -> Type { Type::SliceType(node) } +} +impl From for Type { + fn from(node: TupleType) -> Type { Type::TupleType(node) } +} +impl AstNode for Type { + fn can_cast(kind: SyntaxKind) -> bool { + match kind { + ARRAY_TYPE | DYN_TRAIT_TYPE | FN_POINTER_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE + | INFER_TYPE | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | POINTER_TYPE | REFERENCE_TYPE + | SLICE_TYPE | TUPLE_TYPE => true, + _ => false, } } - fn syntax(&self) -> &SyntaxNode { &self.syntax } -} -impl AstNode for AssocTypeArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } + let res = match syntax.kind() { + ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), + DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), + FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }), + FOR_TYPE => Type::ForType(ForType { syntax }), + IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), + INFER_TYPE => Type::InferType(InferType { syntax }), + NEVER_TYPE => Type::NeverType(NeverType { syntax }), + PAREN_TYPE => Type::ParenType(ParenType { syntax }), + PATH_TYPE => Type::PathType(PathType { syntax }), + POINTER_TYPE => Type::PointerType(PointerType { syntax }), + REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }), + SLICE_TYPE => Type::SliceType(SliceType { syntax }), + TUPLE_TYPE => Type::TupleType(TupleType { syntax }), + _ => return None, + }; + Some(res) } - fn syntax(&self) -> &SyntaxNode { &self.syntax } -} -impl AstNode for ConstArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None + fn syntax(&self) -> &SyntaxNode { + match self { + Type::ArrayType(it) => &it.syntax, + Type::DynTraitType(it) => &it.syntax, + Type::FnPointerType(it) => &it.syntax, + Type::ForType(it) => &it.syntax, + Type::ImplTraitType(it) => &it.syntax, + Type::InferType(it) => &it.syntax, + Type::NeverType(it) => &it.syntax, + Type::ParenType(it) => &it.syntax, + Type::PathType(it) => &it.syntax, + Type::PointerType(it) => &it.syntax, + Type::ReferenceType(it) => &it.syntax, + Type::SliceType(it) => &it.syntax, + Type::TupleType(it) => &it.syntax, } } - fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl From for Item { fn from(node: Const) -> Item { Item::Const(node) } @@ -2853,91 +2939,6 @@ impl AstNode for Item { } } } -impl From for Type { - fn from(node: ArrayType) -> Type { Type::ArrayType(node) } -} -impl From for Type { - fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } -} -impl From for Type { - fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) } -} -impl From for Type { - fn from(node: ForType) -> Type { Type::ForType(node) } -} -impl From for Type { - fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) } -} -impl From for Type { - fn from(node: InferType) -> Type { Type::InferType(node) } -} -impl From for Type { - fn from(node: NeverType) -> Type { Type::NeverType(node) } -} -impl From for Type { - fn from(node: ParenType) -> Type { Type::ParenType(node) } -} -impl From for Type { - fn from(node: PathType) -> Type { Type::PathType(node) } -} -impl From for Type { - fn from(node: PointerType) -> Type { Type::PointerType(node) } -} -impl From for Type { - fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) } -} -impl From for Type { - fn from(node: SliceType) -> Type { Type::SliceType(node) } -} -impl From for Type { - fn from(node: TupleType) -> Type { Type::TupleType(node) } -} -impl AstNode for Type { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ARRAY_TYPE | DYN_TRAIT_TYPE | FN_POINTER_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE - | INFER_TYPE | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | POINTER_TYPE | REFERENCE_TYPE - | SLICE_TYPE | TUPLE_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - let res = match syntax.kind() { - ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), - DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), - FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }), - FOR_TYPE => Type::ForType(ForType { syntax }), - IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), - INFER_TYPE => Type::InferType(InferType { syntax }), - NEVER_TYPE => Type::NeverType(NeverType { syntax }), - PAREN_TYPE => Type::ParenType(ParenType { syntax }), - PATH_TYPE => Type::PathType(PathType { syntax }), - POINTER_TYPE => Type::PointerType(PointerType { syntax }), - REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }), - SLICE_TYPE => Type::SliceType(SliceType { syntax }), - TUPLE_TYPE => Type::TupleType(TupleType { syntax }), - _ => return None, - }; - Some(res) - } - fn syntax(&self) -> &SyntaxNode { - match self { - Type::ArrayType(it) => &it.syntax, - Type::DynTraitType(it) => &it.syntax, - Type::FnPointerType(it) => &it.syntax, - Type::ForType(it) => &it.syntax, - Type::ImplTraitType(it) => &it.syntax, - Type::InferType(it) => &it.syntax, - Type::NeverType(it) => &it.syntax, - Type::ParenType(it) => &it.syntax, - Type::PathType(it) => &it.syntax, - Type::PointerType(it) => &it.syntax, - Type::ReferenceType(it) => &it.syntax, - Type::SliceType(it) => &it.syntax, - Type::TupleType(it) => &it.syntax, - } - } -} impl From for Pat { fn from(node: OrPat) -> Pat { Pat::OrPat(node) } } @@ -3379,12 +3380,12 @@ impl From for Stmt { impl From for Stmt { fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } } -impl std::fmt::Display for Item { +impl std::fmt::Display for Type { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Type { +impl std::fmt::Display for Item { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -3429,6 +3430,76 @@ impl std::fmt::Display for Stmt { std::fmt::Display::fmt(self.syntax(), f) } } +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 PathSegment { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +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 TypeArgList { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for ParamList { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for RetType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for PathType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for TypeArg { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for LifetimeArg { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for AssocTypeArg { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for ConstArg { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} +impl std::fmt::Display for TypeBoundList { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + 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 BlockExpr { + 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) @@ -3524,11 +3595,6 @@ impl std::fmt::Display for ItemList { std::fmt::Display::fmt(self.syntax(), f) } } -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 Rename { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3539,11 +3605,6 @@ impl std::fmt::Display for UseTree { std::fmt::Display::fmt(self.syntax(), f) } } -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 UseTreeList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3559,26 +3620,11 @@ impl std::fmt::Display for GenericParamList { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ParamList { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl std::fmt::Display for RetType { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for WhereClause { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BlockExpr { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for SelfParam { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3589,11 +3635,6 @@ impl std::fmt::Display for Param { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeBoundList { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for RecordFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3654,11 +3695,6 @@ impl std::fmt::Display for WherePred { 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) @@ -3829,11 +3865,6 @@ impl std::fmt::Display for ArgList { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeArgList { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for Condition { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3894,11 +3925,6 @@ impl std::fmt::Display for ParenType { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PathType { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for PointerType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -4024,28 +4050,3 @@ impl std::fmt::Display for MacroStmts { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PathSegment { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl std::fmt::Display for TypeArg { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl std::fmt::Display for LifetimeArg { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl std::fmt::Display for AssocTypeArg { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl std::fmt::Display for ConstArg { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -- cgit v1.2.3