aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs875
-rw-r--r--crates/ra_syntax/src/ast/generated/tokens.rs791
-rw-r--r--xtask/src/codegen/gen_syntax.rs12
3 files changed, 240 insertions, 1438 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 6e258250c..846212a6f 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -16,12 +16,7 @@ impl std::fmt::Display for SourceFile {
16 } 16 }
17} 17}
18impl AstNode for SourceFile { 18impl AstNode for SourceFile {
19 fn can_cast(kind: SyntaxKind) -> bool { 19 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
20 match kind {
21 SOURCE_FILE => true,
22 _ => false,
23 }
24 }
25 fn cast(syntax: SyntaxNode) -> Option<Self> { 20 fn cast(syntax: SyntaxNode) -> Option<Self> {
26 if Self::can_cast(syntax.kind()) { 21 if Self::can_cast(syntax.kind()) {
27 Some(Self { syntax }) 22 Some(Self { syntax })
@@ -47,12 +42,7 @@ impl std::fmt::Display for FnDef {
47 } 42 }
48} 43}
49impl AstNode for FnDef { 44impl AstNode for FnDef {
50 fn can_cast(kind: SyntaxKind) -> bool { 45 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF }
51 match kind {
52 FN_DEF => true,
53 _ => false,
54 }
55 }
56 fn cast(syntax: SyntaxNode) -> Option<Self> { 46 fn cast(syntax: SyntaxNode) -> Option<Self> {
57 if Self::can_cast(syntax.kind()) { 47 if Self::can_cast(syntax.kind()) {
58 Some(Self { syntax }) 48 Some(Self { syntax })
@@ -89,12 +79,7 @@ impl std::fmt::Display for RetType {
89 } 79 }
90} 80}
91impl AstNode for RetType { 81impl AstNode for RetType {
92 fn can_cast(kind: SyntaxKind) -> bool { 82 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
93 match kind {
94 RET_TYPE => true,
95 _ => false,
96 }
97 }
98 fn cast(syntax: SyntaxNode) -> Option<Self> { 83 fn cast(syntax: SyntaxNode) -> Option<Self> {
99 if Self::can_cast(syntax.kind()) { 84 if Self::can_cast(syntax.kind()) {
100 Some(Self { syntax }) 85 Some(Self { syntax })
@@ -118,12 +103,7 @@ impl std::fmt::Display for StructDef {
118 } 103 }
119} 104}
120impl AstNode for StructDef { 105impl AstNode for StructDef {
121 fn can_cast(kind: SyntaxKind) -> bool { 106 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF }
122 match kind {
123 STRUCT_DEF => true,
124 _ => false,
125 }
126 }
127 fn cast(syntax: SyntaxNode) -> Option<Self> { 107 fn cast(syntax: SyntaxNode) -> Option<Self> {
128 if Self::can_cast(syntax.kind()) { 108 if Self::can_cast(syntax.kind()) {
129 Some(Self { syntax }) 109 Some(Self { syntax })
@@ -153,12 +133,7 @@ impl std::fmt::Display for UnionDef {
153 } 133 }
154} 134}
155impl AstNode for UnionDef { 135impl AstNode for UnionDef {
156 fn can_cast(kind: SyntaxKind) -> bool { 136 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF }
157 match kind {
158 UNION_DEF => true,
159 _ => false,
160 }
161 }
162 fn cast(syntax: SyntaxNode) -> Option<Self> { 137 fn cast(syntax: SyntaxNode) -> Option<Self> {
163 if Self::can_cast(syntax.kind()) { 138 if Self::can_cast(syntax.kind()) {
164 Some(Self { syntax }) 139 Some(Self { syntax })
@@ -189,12 +164,7 @@ impl std::fmt::Display for RecordFieldDefList {
189 } 164 }
190} 165}
191impl AstNode for RecordFieldDefList { 166impl AstNode for RecordFieldDefList {
192 fn can_cast(kind: SyntaxKind) -> bool { 167 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST }
193 match kind {
194 RECORD_FIELD_DEF_LIST => true,
195 _ => false,
196 }
197 }
198 fn cast(syntax: SyntaxNode) -> Option<Self> { 168 fn cast(syntax: SyntaxNode) -> Option<Self> {
199 if Self::can_cast(syntax.kind()) { 169 if Self::can_cast(syntax.kind()) {
200 Some(Self { syntax }) 170 Some(Self { syntax })
@@ -219,12 +189,7 @@ impl std::fmt::Display for RecordFieldDef {
219 } 189 }
220} 190}
221impl AstNode for RecordFieldDef { 191impl AstNode for RecordFieldDef {
222 fn can_cast(kind: SyntaxKind) -> bool { 192 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF }
223 match kind {
224 RECORD_FIELD_DEF => true,
225 _ => false,
226 }
227 }
228 fn cast(syntax: SyntaxNode) -> Option<Self> { 193 fn cast(syntax: SyntaxNode) -> Option<Self> {
229 if Self::can_cast(syntax.kind()) { 194 if Self::can_cast(syntax.kind()) {
230 Some(Self { syntax }) 195 Some(Self { syntax })
@@ -250,12 +215,7 @@ impl std::fmt::Display for TupleFieldDefList {
250 } 215 }
251} 216}
252impl AstNode for TupleFieldDefList { 217impl AstNode for TupleFieldDefList {
253 fn can_cast(kind: SyntaxKind) -> bool { 218 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST }
254 match kind {
255 TUPLE_FIELD_DEF_LIST => true,
256 _ => false,
257 }
258 }
259 fn cast(syntax: SyntaxNode) -> Option<Self> { 219 fn cast(syntax: SyntaxNode) -> Option<Self> {
260 if Self::can_cast(syntax.kind()) { 220 if Self::can_cast(syntax.kind()) {
261 Some(Self { syntax }) 221 Some(Self { syntax })
@@ -280,12 +240,7 @@ impl std::fmt::Display for TupleFieldDef {
280 } 240 }
281} 241}
282impl AstNode for TupleFieldDef { 242impl AstNode for TupleFieldDef {
283 fn can_cast(kind: SyntaxKind) -> bool { 243 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF }
284 match kind {
285 TUPLE_FIELD_DEF => true,
286 _ => false,
287 }
288 }
289 fn cast(syntax: SyntaxNode) -> Option<Self> { 244 fn cast(syntax: SyntaxNode) -> Option<Self> {
290 if Self::can_cast(syntax.kind()) { 245 if Self::can_cast(syntax.kind()) {
291 Some(Self { syntax }) 246 Some(Self { syntax })
@@ -310,12 +265,7 @@ impl std::fmt::Display for EnumDef {
310 } 265 }
311} 266}
312impl AstNode for EnumDef { 267impl AstNode for EnumDef {
313 fn can_cast(kind: SyntaxKind) -> bool { 268 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF }
314 match kind {
315 ENUM_DEF => true,
316 _ => false,
317 }
318 }
319 fn cast(syntax: SyntaxNode) -> Option<Self> { 269 fn cast(syntax: SyntaxNode) -> Option<Self> {
320 if Self::can_cast(syntax.kind()) { 270 if Self::can_cast(syntax.kind()) {
321 Some(Self { syntax }) 271 Some(Self { syntax })
@@ -344,12 +294,7 @@ impl std::fmt::Display for EnumVariantList {
344 } 294 }
345} 295}
346impl AstNode for EnumVariantList { 296impl AstNode for EnumVariantList {
347 fn can_cast(kind: SyntaxKind) -> bool { 297 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST }
348 match kind {
349 ENUM_VARIANT_LIST => true,
350 _ => false,
351 }
352 }
353 fn cast(syntax: SyntaxNode) -> Option<Self> { 298 fn cast(syntax: SyntaxNode) -> Option<Self> {
354 if Self::can_cast(syntax.kind()) { 299 if Self::can_cast(syntax.kind()) {
355 Some(Self { syntax }) 300 Some(Self { syntax })
@@ -374,12 +319,7 @@ impl std::fmt::Display for EnumVariant {
374 } 319 }
375} 320}
376impl AstNode for EnumVariant { 321impl AstNode for EnumVariant {
377 fn can_cast(kind: SyntaxKind) -> bool { 322 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT }
378 match kind {
379 ENUM_VARIANT => true,
380 _ => false,
381 }
382 }
383 fn cast(syntax: SyntaxNode) -> Option<Self> { 323 fn cast(syntax: SyntaxNode) -> Option<Self> {
384 if Self::can_cast(syntax.kind()) { 324 if Self::can_cast(syntax.kind()) {
385 Some(Self { syntax }) 325 Some(Self { syntax })
@@ -408,12 +348,7 @@ impl std::fmt::Display for TraitDef {
408 } 348 }
409} 349}
410impl AstNode for TraitDef { 350impl AstNode for TraitDef {
411 fn can_cast(kind: SyntaxKind) -> bool { 351 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF }
412 match kind {
413 TRAIT_DEF => true,
414 _ => false,
415 }
416 }
417 fn cast(syntax: SyntaxNode) -> Option<Self> { 352 fn cast(syntax: SyntaxNode) -> Option<Self> {
418 if Self::can_cast(syntax.kind()) { 353 if Self::can_cast(syntax.kind()) {
419 Some(Self { syntax }) 354 Some(Self { syntax })
@@ -445,12 +380,7 @@ impl std::fmt::Display for Module {
445 } 380 }
446} 381}
447impl AstNode for Module { 382impl AstNode for Module {
448 fn can_cast(kind: SyntaxKind) -> bool { 383 fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE }
449 match kind {
450 MODULE => true,
451 _ => false,
452 }
453 }
454 fn cast(syntax: SyntaxNode) -> Option<Self> { 384 fn cast(syntax: SyntaxNode) -> Option<Self> {
455 if Self::can_cast(syntax.kind()) { 385 if Self::can_cast(syntax.kind()) {
456 Some(Self { syntax }) 386 Some(Self { syntax })
@@ -479,12 +409,7 @@ impl std::fmt::Display for ItemList {
479 } 409 }
480} 410}
481impl AstNode for ItemList { 411impl AstNode for ItemList {
482 fn can_cast(kind: SyntaxKind) -> bool { 412 fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
483 match kind {
484 ITEM_LIST => true,
485 _ => false,
486 }
487 }
488 fn cast(syntax: SyntaxNode) -> Option<Self> { 413 fn cast(syntax: SyntaxNode) -> Option<Self> {
489 if Self::can_cast(syntax.kind()) { 414 if Self::can_cast(syntax.kind()) {
490 Some(Self { syntax }) 415 Some(Self { syntax })
@@ -511,12 +436,7 @@ impl std::fmt::Display for ConstDef {
511 } 436 }
512} 437}
513impl AstNode for ConstDef { 438impl AstNode for ConstDef {
514 fn can_cast(kind: SyntaxKind) -> bool { 439 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF }
515 match kind {
516 CONST_DEF => true,
517 _ => false,
518 }
519 }
520 fn cast(syntax: SyntaxNode) -> Option<Self> { 440 fn cast(syntax: SyntaxNode) -> Option<Self> {
521 if Self::can_cast(syntax.kind()) { 441 if Self::can_cast(syntax.kind()) {
522 Some(Self { syntax }) 442 Some(Self { syntax })
@@ -549,12 +469,7 @@ impl std::fmt::Display for StaticDef {
549 } 469 }
550} 470}
551impl AstNode for StaticDef { 471impl AstNode for StaticDef {
552 fn can_cast(kind: SyntaxKind) -> bool { 472 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF }
553 match kind {
554 STATIC_DEF => true,
555 _ => false,
556 }
557 }
558 fn cast(syntax: SyntaxNode) -> Option<Self> { 473 fn cast(syntax: SyntaxNode) -> Option<Self> {
559 if Self::can_cast(syntax.kind()) { 474 if Self::can_cast(syntax.kind()) {
560 Some(Self { syntax }) 475 Some(Self { syntax })
@@ -587,12 +502,7 @@ impl std::fmt::Display for TypeAliasDef {
587 } 502 }
588} 503}
589impl AstNode for TypeAliasDef { 504impl AstNode for TypeAliasDef {
590 fn can_cast(kind: SyntaxKind) -> bool { 505 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF }
591 match kind {
592 TYPE_ALIAS_DEF => true,
593 _ => false,
594 }
595 }
596 fn cast(syntax: SyntaxNode) -> Option<Self> { 506 fn cast(syntax: SyntaxNode) -> Option<Self> {
597 if Self::can_cast(syntax.kind()) { 507 if Self::can_cast(syntax.kind()) {
598 Some(Self { syntax }) 508 Some(Self { syntax })
@@ -625,12 +535,7 @@ impl std::fmt::Display for ImplDef {
625 } 535 }
626} 536}
627impl AstNode for ImplDef { 537impl AstNode for ImplDef {
628 fn can_cast(kind: SyntaxKind) -> bool { 538 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF }
629 match kind {
630 IMPL_DEF => true,
631 _ => false,
632 }
633 }
634 fn cast(syntax: SyntaxNode) -> Option<Self> { 539 fn cast(syntax: SyntaxNode) -> Option<Self> {
635 if Self::can_cast(syntax.kind()) { 540 if Self::can_cast(syntax.kind()) {
636 Some(Self { syntax }) 541 Some(Self { syntax })
@@ -661,12 +566,7 @@ impl std::fmt::Display for ParenType {
661 } 566 }
662} 567}
663impl AstNode for ParenType { 568impl AstNode for ParenType {
664 fn can_cast(kind: SyntaxKind) -> bool { 569 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE }
665 match kind {
666 PAREN_TYPE => true,
667 _ => false,
668 }
669 }
670 fn cast(syntax: SyntaxNode) -> Option<Self> { 570 fn cast(syntax: SyntaxNode) -> Option<Self> {
671 if Self::can_cast(syntax.kind()) { 571 if Self::can_cast(syntax.kind()) {
672 Some(Self { syntax }) 572 Some(Self { syntax })
@@ -691,12 +591,7 @@ impl std::fmt::Display for TupleType {
691 } 591 }
692} 592}
693impl AstNode for TupleType { 593impl AstNode for TupleType {
694 fn can_cast(kind: SyntaxKind) -> bool { 594 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE }
695 match kind {
696 TUPLE_TYPE => true,
697 _ => false,
698 }
699 }
700 fn cast(syntax: SyntaxNode) -> Option<Self> { 595 fn cast(syntax: SyntaxNode) -> Option<Self> {
701 if Self::can_cast(syntax.kind()) { 596 if Self::can_cast(syntax.kind()) {
702 Some(Self { syntax }) 597 Some(Self { syntax })
@@ -721,12 +616,7 @@ impl std::fmt::Display for NeverType {
721 } 616 }
722} 617}
723impl AstNode for NeverType { 618impl AstNode for NeverType {
724 fn can_cast(kind: SyntaxKind) -> bool { 619 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE }
725 match kind {
726 NEVER_TYPE => true,
727 _ => false,
728 }
729 }
730 fn cast(syntax: SyntaxNode) -> Option<Self> { 620 fn cast(syntax: SyntaxNode) -> Option<Self> {
731 if Self::can_cast(syntax.kind()) { 621 if Self::can_cast(syntax.kind()) {
732 Some(Self { syntax }) 622 Some(Self { syntax })
@@ -749,12 +639,7 @@ impl std::fmt::Display for PathType {
749 } 639 }
750} 640}
751impl AstNode for PathType { 641impl AstNode for PathType {
752 fn can_cast(kind: SyntaxKind) -> bool { 642 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
753 match kind {
754 PATH_TYPE => true,
755 _ => false,
756 }
757 }
758 fn cast(syntax: SyntaxNode) -> Option<Self> { 643 fn cast(syntax: SyntaxNode) -> Option<Self> {
759 if Self::can_cast(syntax.kind()) { 644 if Self::can_cast(syntax.kind()) {
760 Some(Self { syntax }) 645 Some(Self { syntax })
@@ -777,12 +662,7 @@ impl std::fmt::Display for PointerType {
777 } 662 }
778} 663}
779impl AstNode for PointerType { 664impl AstNode for PointerType {
780 fn can_cast(kind: SyntaxKind) -> bool { 665 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE }
781 match kind {
782 POINTER_TYPE => true,
783 _ => false,
784 }
785 }
786 fn cast(syntax: SyntaxNode) -> Option<Self> { 666 fn cast(syntax: SyntaxNode) -> Option<Self> {
787 if Self::can_cast(syntax.kind()) { 667 if Self::can_cast(syntax.kind()) {
788 Some(Self { syntax }) 668 Some(Self { syntax })
@@ -807,12 +687,7 @@ impl std::fmt::Display for ArrayType {
807 } 687 }
808} 688}
809impl AstNode for ArrayType { 689impl AstNode for ArrayType {
810 fn can_cast(kind: SyntaxKind) -> bool { 690 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE }
811 match kind {
812 ARRAY_TYPE => true,
813 _ => false,
814 }
815 }
816 fn cast(syntax: SyntaxNode) -> Option<Self> { 691 fn cast(syntax: SyntaxNode) -> Option<Self> {
817 if Self::can_cast(syntax.kind()) { 692 if Self::can_cast(syntax.kind()) {
818 Some(Self { syntax }) 693 Some(Self { syntax })
@@ -839,12 +714,7 @@ impl std::fmt::Display for SliceType {
839 } 714 }
840} 715}
841impl AstNode for SliceType { 716impl AstNode for SliceType {
842 fn can_cast(kind: SyntaxKind) -> bool { 717 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE }
843 match kind {
844 SLICE_TYPE => true,
845 _ => false,
846 }
847 }
848 fn cast(syntax: SyntaxNode) -> Option<Self> { 718 fn cast(syntax: SyntaxNode) -> Option<Self> {
849 if Self::can_cast(syntax.kind()) { 719 if Self::can_cast(syntax.kind()) {
850 Some(Self { syntax }) 720 Some(Self { syntax })
@@ -869,12 +739,7 @@ impl std::fmt::Display for ReferenceType {
869 } 739 }
870} 740}
871impl AstNode for ReferenceType { 741impl AstNode for ReferenceType {
872 fn can_cast(kind: SyntaxKind) -> bool { 742 fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE }
873 match kind {
874 REFERENCE_TYPE => true,
875 _ => false,
876 }
877 }
878 fn cast(syntax: SyntaxNode) -> Option<Self> { 743 fn cast(syntax: SyntaxNode) -> Option<Self> {
879 if Self::can_cast(syntax.kind()) { 744 if Self::can_cast(syntax.kind()) {
880 Some(Self { syntax }) 745 Some(Self { syntax })
@@ -900,12 +765,7 @@ impl std::fmt::Display for PlaceholderType {
900 } 765 }
901} 766}
902impl AstNode for PlaceholderType { 767impl AstNode for PlaceholderType {
903 fn can_cast(kind: SyntaxKind) -> bool { 768 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE }
904 match kind {
905 PLACEHOLDER_TYPE => true,
906 _ => false,
907 }
908 }
909 fn cast(syntax: SyntaxNode) -> Option<Self> { 769 fn cast(syntax: SyntaxNode) -> Option<Self> {
910 if Self::can_cast(syntax.kind()) { 770 if Self::can_cast(syntax.kind()) {
911 Some(Self { syntax }) 771 Some(Self { syntax })
@@ -928,12 +788,7 @@ impl std::fmt::Display for FnPointerType {
928 } 788 }
929} 789}
930impl AstNode for FnPointerType { 790impl AstNode for FnPointerType {
931 fn can_cast(kind: SyntaxKind) -> bool { 791 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE }
932 match kind {
933 FN_POINTER_TYPE => true,
934 _ => false,
935 }
936 }
937 fn cast(syntax: SyntaxNode) -> Option<Self> { 792 fn cast(syntax: SyntaxNode) -> Option<Self> {
938 if Self::can_cast(syntax.kind()) { 793 if Self::can_cast(syntax.kind()) {
939 Some(Self { syntax }) 794 Some(Self { syntax })
@@ -960,12 +815,7 @@ impl std::fmt::Display for ForType {
960 } 815 }
961} 816}
962impl AstNode for ForType { 817impl AstNode for ForType {
963 fn can_cast(kind: SyntaxKind) -> bool { 818 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE }
964 match kind {
965 FOR_TYPE => true,
966 _ => false,
967 }
968 }
969 fn cast(syntax: SyntaxNode) -> Option<Self> { 819 fn cast(syntax: SyntaxNode) -> Option<Self> {
970 if Self::can_cast(syntax.kind()) { 820 if Self::can_cast(syntax.kind()) {
971 Some(Self { syntax }) 821 Some(Self { syntax })
@@ -990,12 +840,7 @@ impl std::fmt::Display for ImplTraitType {
990 } 840 }
991} 841}
992impl AstNode for ImplTraitType { 842impl AstNode for ImplTraitType {
993 fn can_cast(kind: SyntaxKind) -> bool { 843 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE }
994 match kind {
995 IMPL_TRAIT_TYPE => true,
996 _ => false,
997 }
998 }
999 fn cast(syntax: SyntaxNode) -> Option<Self> { 844 fn cast(syntax: SyntaxNode) -> Option<Self> {
1000 if Self::can_cast(syntax.kind()) { 845 if Self::can_cast(syntax.kind()) {
1001 Some(Self { syntax }) 846 Some(Self { syntax })
@@ -1019,12 +864,7 @@ impl std::fmt::Display for DynTraitType {
1019 } 864 }
1020} 865}
1021impl AstNode for DynTraitType { 866impl AstNode for DynTraitType {
1022 fn can_cast(kind: SyntaxKind) -> bool { 867 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE }
1023 match kind {
1024 DYN_TRAIT_TYPE => true,
1025 _ => false,
1026 }
1027 }
1028 fn cast(syntax: SyntaxNode) -> Option<Self> { 868 fn cast(syntax: SyntaxNode) -> Option<Self> {
1029 if Self::can_cast(syntax.kind()) { 869 if Self::can_cast(syntax.kind()) {
1030 Some(Self { syntax }) 870 Some(Self { syntax })
@@ -1048,12 +888,7 @@ impl std::fmt::Display for TupleExpr {
1048 } 888 }
1049} 889}
1050impl AstNode for TupleExpr { 890impl AstNode for TupleExpr {
1051 fn can_cast(kind: SyntaxKind) -> bool { 891 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR }
1052 match kind {
1053 TUPLE_EXPR => true,
1054 _ => false,
1055 }
1056 }
1057 fn cast(syntax: SyntaxNode) -> Option<Self> { 892 fn cast(syntax: SyntaxNode) -> Option<Self> {
1058 if Self::can_cast(syntax.kind()) { 893 if Self::can_cast(syntax.kind()) {
1059 Some(Self { syntax }) 894 Some(Self { syntax })
@@ -1079,12 +914,7 @@ impl std::fmt::Display for ArrayExpr {
1079 } 914 }
1080} 915}
1081impl AstNode for ArrayExpr { 916impl AstNode for ArrayExpr {
1082 fn can_cast(kind: SyntaxKind) -> bool { 917 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR }
1083 match kind {
1084 ARRAY_EXPR => true,
1085 _ => false,
1086 }
1087 }
1088 fn cast(syntax: SyntaxNode) -> Option<Self> { 918 fn cast(syntax: SyntaxNode) -> Option<Self> {
1089 if Self::can_cast(syntax.kind()) { 919 if Self::can_cast(syntax.kind()) {
1090 Some(Self { syntax }) 920 Some(Self { syntax })
@@ -1111,12 +941,7 @@ impl std::fmt::Display for ParenExpr {
1111 } 941 }
1112} 942}
1113impl AstNode for ParenExpr { 943impl AstNode for ParenExpr {
1114 fn can_cast(kind: SyntaxKind) -> bool { 944 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR }
1115 match kind {
1116 PAREN_EXPR => true,
1117 _ => false,
1118 }
1119 }
1120 fn cast(syntax: SyntaxNode) -> Option<Self> { 945 fn cast(syntax: SyntaxNode) -> Option<Self> {
1121 if Self::can_cast(syntax.kind()) { 946 if Self::can_cast(syntax.kind()) {
1122 Some(Self { syntax }) 947 Some(Self { syntax })
@@ -1142,12 +967,7 @@ impl std::fmt::Display for PathExpr {
1142 } 967 }
1143} 968}
1144impl AstNode for PathExpr { 969impl AstNode for PathExpr {
1145 fn can_cast(kind: SyntaxKind) -> bool { 970 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR }
1146 match kind {
1147 PATH_EXPR => true,
1148 _ => false,
1149 }
1150 }
1151 fn cast(syntax: SyntaxNode) -> Option<Self> { 971 fn cast(syntax: SyntaxNode) -> Option<Self> {
1152 if Self::can_cast(syntax.kind()) { 972 if Self::can_cast(syntax.kind()) {
1153 Some(Self { syntax }) 973 Some(Self { syntax })
@@ -1170,12 +990,7 @@ impl std::fmt::Display for LambdaExpr {
1170 } 990 }
1171} 991}
1172impl AstNode for LambdaExpr { 992impl AstNode for LambdaExpr {
1173 fn can_cast(kind: SyntaxKind) -> bool { 993 fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR }
1174 match kind {
1175 LAMBDA_EXPR => true,
1176 _ => false,
1177 }
1178 }
1179 fn cast(syntax: SyntaxNode) -> Option<Self> { 994 fn cast(syntax: SyntaxNode) -> Option<Self> {
1180 if Self::can_cast(syntax.kind()) { 995 if Self::can_cast(syntax.kind()) {
1181 Some(Self { syntax }) 996 Some(Self { syntax })
@@ -1204,12 +1019,7 @@ impl std::fmt::Display for IfExpr {
1204 } 1019 }
1205} 1020}
1206impl AstNode for IfExpr { 1021impl AstNode for IfExpr {
1207 fn can_cast(kind: SyntaxKind) -> bool { 1022 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR }
1208 match kind {
1209 IF_EXPR => true,
1210 _ => false,
1211 }
1212 }
1213 fn cast(syntax: SyntaxNode) -> Option<Self> { 1023 fn cast(syntax: SyntaxNode) -> Option<Self> {
1214 if Self::can_cast(syntax.kind()) { 1024 if Self::can_cast(syntax.kind()) {
1215 Some(Self { syntax }) 1025 Some(Self { syntax })
@@ -1234,12 +1044,7 @@ impl std::fmt::Display for LoopExpr {
1234 } 1044 }
1235} 1045}
1236impl AstNode for LoopExpr { 1046impl AstNode for LoopExpr {
1237 fn can_cast(kind: SyntaxKind) -> bool { 1047 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR }
1238 match kind {
1239 LOOP_EXPR => true,
1240 _ => false,
1241 }
1242 }
1243 fn cast(syntax: SyntaxNode) -> Option<Self> { 1048 fn cast(syntax: SyntaxNode) -> Option<Self> {
1244 if Self::can_cast(syntax.kind()) { 1049 if Self::can_cast(syntax.kind()) {
1245 Some(Self { syntax }) 1050 Some(Self { syntax })
@@ -1264,12 +1069,7 @@ impl std::fmt::Display for TryBlockExpr {
1264 } 1069 }
1265} 1070}
1266impl AstNode for TryBlockExpr { 1071impl AstNode for TryBlockExpr {
1267 fn can_cast(kind: SyntaxKind) -> bool { 1072 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_BLOCK_EXPR }
1268 match kind {
1269 TRY_BLOCK_EXPR => true,
1270 _ => false,
1271 }
1272 }
1273 fn cast(syntax: SyntaxNode) -> Option<Self> { 1073 fn cast(syntax: SyntaxNode) -> Option<Self> {
1274 if Self::can_cast(syntax.kind()) { 1074 if Self::can_cast(syntax.kind()) {
1275 Some(Self { syntax }) 1075 Some(Self { syntax })
@@ -1294,12 +1094,7 @@ impl std::fmt::Display for ForExpr {
1294 } 1094 }
1295} 1095}
1296impl AstNode for ForExpr { 1096impl AstNode for ForExpr {
1297 fn can_cast(kind: SyntaxKind) -> bool { 1097 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR }
1298 match kind {
1299 FOR_EXPR => true,
1300 _ => false,
1301 }
1302 }
1303 fn cast(syntax: SyntaxNode) -> Option<Self> { 1098 fn cast(syntax: SyntaxNode) -> Option<Self> {
1304 if Self::can_cast(syntax.kind()) { 1099 if Self::can_cast(syntax.kind()) {
1305 Some(Self { syntax }) 1100 Some(Self { syntax })
@@ -1327,12 +1122,7 @@ impl std::fmt::Display for WhileExpr {
1327 } 1122 }
1328} 1123}
1329impl AstNode for WhileExpr { 1124impl AstNode for WhileExpr {
1330 fn can_cast(kind: SyntaxKind) -> bool { 1125 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR }
1331 match kind {
1332 WHILE_EXPR => true,
1333 _ => false,
1334 }
1335 }
1336 fn cast(syntax: SyntaxNode) -> Option<Self> { 1126 fn cast(syntax: SyntaxNode) -> Option<Self> {
1337 if Self::can_cast(syntax.kind()) { 1127 if Self::can_cast(syntax.kind()) {
1338 Some(Self { syntax }) 1128 Some(Self { syntax })
@@ -1358,12 +1148,7 @@ impl std::fmt::Display for ContinueExpr {
1358 } 1148 }
1359} 1149}
1360impl AstNode for ContinueExpr { 1150impl AstNode for ContinueExpr {
1361 fn can_cast(kind: SyntaxKind) -> bool { 1151 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR }
1362 match kind {
1363 CONTINUE_EXPR => true,
1364 _ => false,
1365 }
1366 }
1367 fn cast(syntax: SyntaxNode) -> Option<Self> { 1152 fn cast(syntax: SyntaxNode) -> Option<Self> {
1368 if Self::can_cast(syntax.kind()) { 1153 if Self::can_cast(syntax.kind()) {
1369 Some(Self { syntax }) 1154 Some(Self { syntax })
@@ -1388,12 +1173,7 @@ impl std::fmt::Display for BreakExpr {
1388 } 1173 }
1389} 1174}
1390impl AstNode for BreakExpr { 1175impl AstNode for BreakExpr {
1391 fn can_cast(kind: SyntaxKind) -> bool { 1176 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR }
1392 match kind {
1393 BREAK_EXPR => true,
1394 _ => false,
1395 }
1396 }
1397 fn cast(syntax: SyntaxNode) -> Option<Self> { 1177 fn cast(syntax: SyntaxNode) -> Option<Self> {
1398 if Self::can_cast(syntax.kind()) { 1178 if Self::can_cast(syntax.kind()) {
1399 Some(Self { syntax }) 1179 Some(Self { syntax })
@@ -1419,12 +1199,7 @@ impl std::fmt::Display for Label {
1419 } 1199 }
1420} 1200}
1421impl AstNode for Label { 1201impl AstNode for Label {
1422 fn can_cast(kind: SyntaxKind) -> bool { 1202 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL }
1423 match kind {
1424 LABEL => true,
1425 _ => false,
1426 }
1427 }
1428 fn cast(syntax: SyntaxNode) -> Option<Self> { 1203 fn cast(syntax: SyntaxNode) -> Option<Self> {
1429 if Self::can_cast(syntax.kind()) { 1204 if Self::can_cast(syntax.kind()) {
1430 Some(Self { syntax }) 1205 Some(Self { syntax })
@@ -1447,12 +1222,7 @@ impl std::fmt::Display for BlockExpr {
1447 } 1222 }
1448} 1223}
1449impl AstNode for BlockExpr { 1224impl AstNode for BlockExpr {
1450 fn can_cast(kind: SyntaxKind) -> bool { 1225 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR }
1451 match kind {
1452 BLOCK_EXPR => true,
1453 _ => false,
1454 }
1455 }
1456 fn cast(syntax: SyntaxNode) -> Option<Self> { 1226 fn cast(syntax: SyntaxNode) -> Option<Self> {
1457 if Self::can_cast(syntax.kind()) { 1227 if Self::can_cast(syntax.kind()) {
1458 Some(Self { syntax }) 1228 Some(Self { syntax })
@@ -1478,12 +1248,7 @@ impl std::fmt::Display for ReturnExpr {
1478 } 1248 }
1479} 1249}
1480impl AstNode for ReturnExpr { 1250impl AstNode for ReturnExpr {
1481 fn can_cast(kind: SyntaxKind) -> bool { 1251 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR }
1482 match kind {
1483 RETURN_EXPR => true,
1484 _ => false,
1485 }
1486 }
1487 fn cast(syntax: SyntaxNode) -> Option<Self> { 1252 fn cast(syntax: SyntaxNode) -> Option<Self> {
1488 if Self::can_cast(syntax.kind()) { 1253 if Self::can_cast(syntax.kind()) {
1489 Some(Self { syntax }) 1254 Some(Self { syntax })
@@ -1507,12 +1272,7 @@ impl std::fmt::Display for CallExpr {
1507 } 1272 }
1508} 1273}
1509impl AstNode for CallExpr { 1274impl AstNode for CallExpr {
1510 fn can_cast(kind: SyntaxKind) -> bool { 1275 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR }
1511 match kind {
1512 CALL_EXPR => true,
1513 _ => false,
1514 }
1515 }
1516 fn cast(syntax: SyntaxNode) -> Option<Self> { 1276 fn cast(syntax: SyntaxNode) -> Option<Self> {
1517 if Self::can_cast(syntax.kind()) { 1277 if Self::can_cast(syntax.kind()) {
1518 Some(Self { syntax }) 1278 Some(Self { syntax })
@@ -1536,12 +1296,7 @@ impl std::fmt::Display for MethodCallExpr {
1536 } 1296 }
1537} 1297}
1538impl AstNode for MethodCallExpr { 1298impl AstNode for MethodCallExpr {
1539 fn can_cast(kind: SyntaxKind) -> bool { 1299 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR }
1540 match kind {
1541 METHOD_CALL_EXPR => true,
1542 _ => false,
1543 }
1544 }
1545 fn cast(syntax: SyntaxNode) -> Option<Self> { 1300 fn cast(syntax: SyntaxNode) -> Option<Self> {
1546 if Self::can_cast(syntax.kind()) { 1301 if Self::can_cast(syntax.kind()) {
1547 Some(Self { syntax }) 1302 Some(Self { syntax })
@@ -1569,12 +1324,7 @@ impl std::fmt::Display for IndexExpr {
1569 } 1324 }
1570} 1325}
1571impl AstNode for IndexExpr { 1326impl AstNode for IndexExpr {
1572 fn can_cast(kind: SyntaxKind) -> bool { 1327 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR }
1573 match kind {
1574 INDEX_EXPR => true,
1575 _ => false,
1576 }
1577 }
1578 fn cast(syntax: SyntaxNode) -> Option<Self> { 1328 fn cast(syntax: SyntaxNode) -> Option<Self> {
1579 if Self::can_cast(syntax.kind()) { 1329 if Self::can_cast(syntax.kind()) {
1580 Some(Self { syntax }) 1330 Some(Self { syntax })
@@ -1599,12 +1349,7 @@ impl std::fmt::Display for FieldExpr {
1599 } 1349 }
1600} 1350}
1601impl AstNode for FieldExpr { 1351impl AstNode for FieldExpr {
1602 fn can_cast(kind: SyntaxKind) -> bool { 1352 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR }
1603 match kind {
1604 FIELD_EXPR => true,
1605 _ => false,
1606 }
1607 }
1608 fn cast(syntax: SyntaxNode) -> Option<Self> { 1353 fn cast(syntax: SyntaxNode) -> Option<Self> {
1609 if Self::can_cast(syntax.kind()) { 1354 if Self::can_cast(syntax.kind()) {
1610 Some(Self { syntax }) 1355 Some(Self { syntax })
@@ -1630,12 +1375,7 @@ impl std::fmt::Display for AwaitExpr {
1630 } 1375 }
1631} 1376}
1632impl AstNode for AwaitExpr { 1377impl AstNode for AwaitExpr {
1633 fn can_cast(kind: SyntaxKind) -> bool { 1378 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR }
1634 match kind {
1635 AWAIT_EXPR => true,
1636 _ => false,
1637 }
1638 }
1639 fn cast(syntax: SyntaxNode) -> Option<Self> { 1379 fn cast(syntax: SyntaxNode) -> Option<Self> {
1640 if Self::can_cast(syntax.kind()) { 1380 if Self::can_cast(syntax.kind()) {
1641 Some(Self { syntax }) 1381 Some(Self { syntax })
@@ -1661,12 +1401,7 @@ impl std::fmt::Display for TryExpr {
1661 } 1401 }
1662} 1402}
1663impl AstNode for TryExpr { 1403impl AstNode for TryExpr {
1664 fn can_cast(kind: SyntaxKind) -> bool { 1404 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR }
1665 match kind {
1666 TRY_EXPR => true,
1667 _ => false,
1668 }
1669 }
1670 fn cast(syntax: SyntaxNode) -> Option<Self> { 1405 fn cast(syntax: SyntaxNode) -> Option<Self> {
1671 if Self::can_cast(syntax.kind()) { 1406 if Self::can_cast(syntax.kind()) {
1672 Some(Self { syntax }) 1407 Some(Self { syntax })
@@ -1691,12 +1426,7 @@ impl std::fmt::Display for CastExpr {
1691 } 1426 }
1692} 1427}
1693impl AstNode for CastExpr { 1428impl AstNode for CastExpr {
1694 fn can_cast(kind: SyntaxKind) -> bool { 1429 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR }
1695 match kind {
1696 CAST_EXPR => true,
1697 _ => false,
1698 }
1699 }
1700 fn cast(syntax: SyntaxNode) -> Option<Self> { 1430 fn cast(syntax: SyntaxNode) -> Option<Self> {
1701 if Self::can_cast(syntax.kind()) { 1431 if Self::can_cast(syntax.kind()) {
1702 Some(Self { syntax }) 1432 Some(Self { syntax })
@@ -1722,12 +1452,7 @@ impl std::fmt::Display for RefExpr {
1722 } 1452 }
1723} 1453}
1724impl AstNode for RefExpr { 1454impl AstNode for RefExpr {
1725 fn can_cast(kind: SyntaxKind) -> bool { 1455 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR }
1726 match kind {
1727 REF_EXPR => true,
1728 _ => false,
1729 }
1730 }
1731 fn cast(syntax: SyntaxNode) -> Option<Self> { 1456 fn cast(syntax: SyntaxNode) -> Option<Self> {
1732 if Self::can_cast(syntax.kind()) { 1457 if Self::can_cast(syntax.kind()) {
1733 Some(Self { syntax }) 1458 Some(Self { syntax })
@@ -1754,12 +1479,7 @@ impl std::fmt::Display for PrefixExpr {
1754 } 1479 }
1755} 1480}
1756impl AstNode for PrefixExpr { 1481impl AstNode for PrefixExpr {
1757 fn can_cast(kind: SyntaxKind) -> bool { 1482 fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR }
1758 match kind {
1759 PREFIX_EXPR => true,
1760 _ => false,
1761 }
1762 }
1763 fn cast(syntax: SyntaxNode) -> Option<Self> { 1483 fn cast(syntax: SyntaxNode) -> Option<Self> {
1764 if Self::can_cast(syntax.kind()) { 1484 if Self::can_cast(syntax.kind()) {
1765 Some(Self { syntax }) 1485 Some(Self { syntax })
@@ -1784,12 +1504,7 @@ impl std::fmt::Display for BoxExpr {
1784 } 1504 }
1785} 1505}
1786impl AstNode for BoxExpr { 1506impl AstNode for BoxExpr {
1787 fn can_cast(kind: SyntaxKind) -> bool { 1507 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR }
1788 match kind {
1789 BOX_EXPR => true,
1790 _ => false,
1791 }
1792 }
1793 fn cast(syntax: SyntaxNode) -> Option<Self> { 1508 fn cast(syntax: SyntaxNode) -> Option<Self> {
1794 if Self::can_cast(syntax.kind()) { 1509 if Self::can_cast(syntax.kind()) {
1795 Some(Self { syntax }) 1510 Some(Self { syntax })
@@ -1814,12 +1529,7 @@ impl std::fmt::Display for RangeExpr {
1814 } 1529 }
1815} 1530}
1816impl AstNode for RangeExpr { 1531impl AstNode for RangeExpr {
1817 fn can_cast(kind: SyntaxKind) -> bool { 1532 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR }
1818 match kind {
1819 RANGE_EXPR => true,
1820 _ => false,
1821 }
1822 }
1823 fn cast(syntax: SyntaxNode) -> Option<Self> { 1533 fn cast(syntax: SyntaxNode) -> Option<Self> {
1824 if Self::can_cast(syntax.kind()) { 1534 if Self::can_cast(syntax.kind()) {
1825 Some(Self { syntax }) 1535 Some(Self { syntax })
@@ -1843,12 +1553,7 @@ impl std::fmt::Display for BinExpr {
1843 } 1553 }
1844} 1554}
1845impl AstNode for BinExpr { 1555impl AstNode for BinExpr {
1846 fn can_cast(kind: SyntaxKind) -> bool { 1556 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR }
1847 match kind {
1848 BIN_EXPR => true,
1849 _ => false,
1850 }
1851 }
1852 fn cast(syntax: SyntaxNode) -> Option<Self> { 1557 fn cast(syntax: SyntaxNode) -> Option<Self> {
1853 if Self::can_cast(syntax.kind()) { 1558 if Self::can_cast(syntax.kind()) {
1854 Some(Self { syntax }) 1559 Some(Self { syntax })
@@ -1872,12 +1577,7 @@ impl std::fmt::Display for Literal {
1872 } 1577 }
1873} 1578}
1874impl AstNode for Literal { 1579impl AstNode for Literal {
1875 fn can_cast(kind: SyntaxKind) -> bool { 1580 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL }
1876 match kind {
1877 LITERAL => true,
1878 _ => false,
1879 }
1880 }
1881 fn cast(syntax: SyntaxNode) -> Option<Self> { 1581 fn cast(syntax: SyntaxNode) -> Option<Self> {
1882 if Self::can_cast(syntax.kind()) { 1582 if Self::can_cast(syntax.kind()) {
1883 Some(Self { syntax }) 1583 Some(Self { syntax })
@@ -1900,12 +1600,7 @@ impl std::fmt::Display for MatchExpr {
1900 } 1600 }
1901} 1601}
1902impl AstNode for MatchExpr { 1602impl AstNode for MatchExpr {
1903 fn can_cast(kind: SyntaxKind) -> bool { 1603 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR }
1904 match kind {
1905 MATCH_EXPR => true,
1906 _ => false,
1907 }
1908 }
1909 fn cast(syntax: SyntaxNode) -> Option<Self> { 1604 fn cast(syntax: SyntaxNode) -> Option<Self> {
1910 if Self::can_cast(syntax.kind()) { 1605 if Self::can_cast(syntax.kind()) {
1911 Some(Self { syntax }) 1606 Some(Self { syntax })
@@ -1931,12 +1626,7 @@ impl std::fmt::Display for MatchArmList {
1931 } 1626 }
1932} 1627}
1933impl AstNode for MatchArmList { 1628impl AstNode for MatchArmList {
1934 fn can_cast(kind: SyntaxKind) -> bool { 1629 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST }
1935 match kind {
1936 MATCH_ARM_LIST => true,
1937 _ => false,
1938 }
1939 }
1940 fn cast(syntax: SyntaxNode) -> Option<Self> { 1630 fn cast(syntax: SyntaxNode) -> Option<Self> {
1941 if Self::can_cast(syntax.kind()) { 1631 if Self::can_cast(syntax.kind()) {
1942 Some(Self { syntax }) 1632 Some(Self { syntax })
@@ -1962,12 +1652,7 @@ impl std::fmt::Display for MatchArm {
1962 } 1652 }
1963} 1653}
1964impl AstNode for MatchArm { 1654impl AstNode for MatchArm {
1965 fn can_cast(kind: SyntaxKind) -> bool { 1655 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM }
1966 match kind {
1967 MATCH_ARM => true,
1968 _ => false,
1969 }
1970 }
1971 fn cast(syntax: SyntaxNode) -> Option<Self> { 1656 fn cast(syntax: SyntaxNode) -> Option<Self> {
1972 if Self::can_cast(syntax.kind()) { 1657 if Self::can_cast(syntax.kind()) {
1973 Some(Self { syntax }) 1658 Some(Self { syntax })
@@ -1994,12 +1679,7 @@ impl std::fmt::Display for MatchGuard {
1994 } 1679 }
1995} 1680}
1996impl AstNode for MatchGuard { 1681impl AstNode for MatchGuard {
1997 fn can_cast(kind: SyntaxKind) -> bool { 1682 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD }
1998 match kind {
1999 MATCH_GUARD => true,
2000 _ => false,
2001 }
2002 }
2003 fn cast(syntax: SyntaxNode) -> Option<Self> { 1683 fn cast(syntax: SyntaxNode) -> Option<Self> {
2004 if Self::can_cast(syntax.kind()) { 1684 if Self::can_cast(syntax.kind()) {
2005 Some(Self { syntax }) 1685 Some(Self { syntax })
@@ -2023,12 +1703,7 @@ impl std::fmt::Display for RecordLit {
2023 } 1703 }
2024} 1704}
2025impl AstNode for RecordLit { 1705impl AstNode for RecordLit {
2026 fn can_cast(kind: SyntaxKind) -> bool { 1706 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT }
2027 match kind {
2028 RECORD_LIT => true,
2029 _ => false,
2030 }
2031 }
2032 fn cast(syntax: SyntaxNode) -> Option<Self> { 1707 fn cast(syntax: SyntaxNode) -> Option<Self> {
2033 if Self::can_cast(syntax.kind()) { 1708 if Self::can_cast(syntax.kind()) {
2034 Some(Self { syntax }) 1709 Some(Self { syntax })
@@ -2052,12 +1727,7 @@ impl std::fmt::Display for RecordFieldList {
2052 } 1727 }
2053} 1728}
2054impl AstNode for RecordFieldList { 1729impl AstNode for RecordFieldList {
2055 fn can_cast(kind: SyntaxKind) -> bool { 1730 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
2056 match kind {
2057 RECORD_FIELD_LIST => true,
2058 _ => false,
2059 }
2060 }
2061 fn cast(syntax: SyntaxNode) -> Option<Self> { 1731 fn cast(syntax: SyntaxNode) -> Option<Self> {
2062 if Self::can_cast(syntax.kind()) { 1732 if Self::can_cast(syntax.kind()) {
2063 Some(Self { syntax }) 1733 Some(Self { syntax })
@@ -2084,12 +1754,7 @@ impl std::fmt::Display for RecordField {
2084 } 1754 }
2085} 1755}
2086impl AstNode for RecordField { 1756impl AstNode for RecordField {
2087 fn can_cast(kind: SyntaxKind) -> bool { 1757 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
2088 match kind {
2089 RECORD_FIELD => true,
2090 _ => false,
2091 }
2092 }
2093 fn cast(syntax: SyntaxNode) -> Option<Self> { 1758 fn cast(syntax: SyntaxNode) -> Option<Self> {
2094 if Self::can_cast(syntax.kind()) { 1759 if Self::can_cast(syntax.kind()) {
2095 Some(Self { syntax }) 1760 Some(Self { syntax })
@@ -2115,12 +1780,7 @@ impl std::fmt::Display for OrPat {
2115 } 1780 }
2116} 1781}
2117impl AstNode for OrPat { 1782impl AstNode for OrPat {
2118 fn can_cast(kind: SyntaxKind) -> bool { 1783 fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT }
2119 match kind {
2120 OR_PAT => true,
2121 _ => false,
2122 }
2123 }
2124 fn cast(syntax: SyntaxNode) -> Option<Self> { 1784 fn cast(syntax: SyntaxNode) -> Option<Self> {
2125 if Self::can_cast(syntax.kind()) { 1785 if Self::can_cast(syntax.kind()) {
2126 Some(Self { syntax }) 1786 Some(Self { syntax })
@@ -2143,12 +1803,7 @@ impl std::fmt::Display for ParenPat {
2143 } 1803 }
2144} 1804}
2145impl AstNode for ParenPat { 1805impl AstNode for ParenPat {
2146 fn can_cast(kind: SyntaxKind) -> bool { 1806 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT }
2147 match kind {
2148 PAREN_PAT => true,
2149 _ => false,
2150 }
2151 }
2152 fn cast(syntax: SyntaxNode) -> Option<Self> { 1807 fn cast(syntax: SyntaxNode) -> Option<Self> {
2153 if Self::can_cast(syntax.kind()) { 1808 if Self::can_cast(syntax.kind()) {
2154 Some(Self { syntax }) 1809 Some(Self { syntax })
@@ -2173,12 +1828,7 @@ impl std::fmt::Display for RefPat {
2173 } 1828 }
2174} 1829}
2175impl AstNode for RefPat { 1830impl AstNode for RefPat {
2176 fn can_cast(kind: SyntaxKind) -> bool { 1831 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT }
2177 match kind {
2178 REF_PAT => true,
2179 _ => false,
2180 }
2181 }
2182 fn cast(syntax: SyntaxNode) -> Option<Self> { 1832 fn cast(syntax: SyntaxNode) -> Option<Self> {
2183 if Self::can_cast(syntax.kind()) { 1833 if Self::can_cast(syntax.kind()) {
2184 Some(Self { syntax }) 1834 Some(Self { syntax })
@@ -2203,12 +1853,7 @@ impl std::fmt::Display for BoxPat {
2203 } 1853 }
2204} 1854}
2205impl AstNode for BoxPat { 1855impl AstNode for BoxPat {
2206 fn can_cast(kind: SyntaxKind) -> bool { 1856 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT }
2207 match kind {
2208 BOX_PAT => true,
2209 _ => false,
2210 }
2211 }
2212 fn cast(syntax: SyntaxNode) -> Option<Self> { 1857 fn cast(syntax: SyntaxNode) -> Option<Self> {
2213 if Self::can_cast(syntax.kind()) { 1858 if Self::can_cast(syntax.kind()) {
2214 Some(Self { syntax }) 1859 Some(Self { syntax })
@@ -2232,12 +1877,7 @@ impl std::fmt::Display for BindPat {
2232 } 1877 }
2233} 1878}
2234impl AstNode for BindPat { 1879impl AstNode for BindPat {
2235 fn can_cast(kind: SyntaxKind) -> bool { 1880 fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT }
2236 match kind {
2237 BIND_PAT => true,
2238 _ => false,
2239 }
2240 }
2241 fn cast(syntax: SyntaxNode) -> Option<Self> { 1881 fn cast(syntax: SyntaxNode) -> Option<Self> {
2242 if Self::can_cast(syntax.kind()) { 1882 if Self::can_cast(syntax.kind()) {
2243 Some(Self { syntax }) 1883 Some(Self { syntax })
@@ -2264,12 +1904,7 @@ impl std::fmt::Display for PlaceholderPat {
2264 } 1904 }
2265} 1905}
2266impl AstNode for PlaceholderPat { 1906impl AstNode for PlaceholderPat {
2267 fn can_cast(kind: SyntaxKind) -> bool { 1907 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT }
2268 match kind {
2269 PLACEHOLDER_PAT => true,
2270 _ => false,
2271 }
2272 }
2273 fn cast(syntax: SyntaxNode) -> Option<Self> { 1908 fn cast(syntax: SyntaxNode) -> Option<Self> {
2274 if Self::can_cast(syntax.kind()) { 1909 if Self::can_cast(syntax.kind()) {
2275 Some(Self { syntax }) 1910 Some(Self { syntax })
@@ -2292,12 +1927,7 @@ impl std::fmt::Display for DotDotPat {
2292 } 1927 }
2293} 1928}
2294impl AstNode for DotDotPat { 1929impl AstNode for DotDotPat {
2295 fn can_cast(kind: SyntaxKind) -> bool { 1930 fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT }
2296 match kind {
2297 DOT_DOT_PAT => true,
2298 _ => false,
2299 }
2300 }
2301 fn cast(syntax: SyntaxNode) -> Option<Self> { 1931 fn cast(syntax: SyntaxNode) -> Option<Self> {
2302 if Self::can_cast(syntax.kind()) { 1932 if Self::can_cast(syntax.kind()) {
2303 Some(Self { syntax }) 1933 Some(Self { syntax })
@@ -2320,12 +1950,7 @@ impl std::fmt::Display for PathPat {
2320 } 1950 }
2321} 1951}
2322impl AstNode for PathPat { 1952impl AstNode for PathPat {
2323 fn can_cast(kind: SyntaxKind) -> bool { 1953 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT }
2324 match kind {
2325 PATH_PAT => true,
2326 _ => false,
2327 }
2328 }
2329 fn cast(syntax: SyntaxNode) -> Option<Self> { 1954 fn cast(syntax: SyntaxNode) -> Option<Self> {
2330 if Self::can_cast(syntax.kind()) { 1955 if Self::can_cast(syntax.kind()) {
2331 Some(Self { syntax }) 1956 Some(Self { syntax })
@@ -2348,12 +1973,7 @@ impl std::fmt::Display for SlicePat {
2348 } 1973 }
2349} 1974}
2350impl AstNode for SlicePat { 1975impl AstNode for SlicePat {
2351 fn can_cast(kind: SyntaxKind) -> bool { 1976 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT }
2352 match kind {
2353 SLICE_PAT => true,
2354 _ => false,
2355 }
2356 }
2357 fn cast(syntax: SyntaxNode) -> Option<Self> { 1977 fn cast(syntax: SyntaxNode) -> Option<Self> {
2358 if Self::can_cast(syntax.kind()) { 1978 if Self::can_cast(syntax.kind()) {
2359 Some(Self { syntax }) 1979 Some(Self { syntax })
@@ -2378,12 +1998,7 @@ impl std::fmt::Display for RangePat {
2378 } 1998 }
2379} 1999}
2380impl AstNode for RangePat { 2000impl AstNode for RangePat {
2381 fn can_cast(kind: SyntaxKind) -> bool { 2001 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT }
2382 match kind {
2383 RANGE_PAT => true,
2384 _ => false,
2385 }
2386 }
2387 fn cast(syntax: SyntaxNode) -> Option<Self> { 2002 fn cast(syntax: SyntaxNode) -> Option<Self> {
2388 if Self::can_cast(syntax.kind()) { 2003 if Self::can_cast(syntax.kind()) {
2389 Some(Self { syntax }) 2004 Some(Self { syntax })
@@ -2406,12 +2021,7 @@ impl std::fmt::Display for LiteralPat {
2406 } 2021 }
2407} 2022}
2408impl AstNode for LiteralPat { 2023impl AstNode for LiteralPat {
2409 fn can_cast(kind: SyntaxKind) -> bool { 2024 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT }
2410 match kind {
2411 LITERAL_PAT => true,
2412 _ => false,
2413 }
2414 }
2415 fn cast(syntax: SyntaxNode) -> Option<Self> { 2025 fn cast(syntax: SyntaxNode) -> Option<Self> {
2416 if Self::can_cast(syntax.kind()) { 2026 if Self::can_cast(syntax.kind()) {
2417 Some(Self { syntax }) 2027 Some(Self { syntax })
@@ -2434,12 +2044,7 @@ impl std::fmt::Display for MacroPat {
2434 } 2044 }
2435} 2045}
2436impl AstNode for MacroPat { 2046impl AstNode for MacroPat {
2437 fn can_cast(kind: SyntaxKind) -> bool { 2047 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT }
2438 match kind {
2439 MACRO_PAT => true,
2440 _ => false,
2441 }
2442 }
2443 fn cast(syntax: SyntaxNode) -> Option<Self> { 2048 fn cast(syntax: SyntaxNode) -> Option<Self> {
2444 if Self::can_cast(syntax.kind()) { 2049 if Self::can_cast(syntax.kind()) {
2445 Some(Self { syntax }) 2050 Some(Self { syntax })
@@ -2462,12 +2067,7 @@ impl std::fmt::Display for RecordPat {
2462 } 2067 }
2463} 2068}
2464impl AstNode for RecordPat { 2069impl AstNode for RecordPat {
2465 fn can_cast(kind: SyntaxKind) -> bool { 2070 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT }
2466 match kind {
2467 RECORD_PAT => true,
2468 _ => false,
2469 }
2470 }
2471 fn cast(syntax: SyntaxNode) -> Option<Self> { 2071 fn cast(syntax: SyntaxNode) -> Option<Self> {
2472 if Self::can_cast(syntax.kind()) { 2072 if Self::can_cast(syntax.kind()) {
2473 Some(Self { syntax }) 2073 Some(Self { syntax })
@@ -2493,12 +2093,7 @@ impl std::fmt::Display for RecordFieldPatList {
2493 } 2093 }
2494} 2094}
2495impl AstNode for RecordFieldPatList { 2095impl AstNode for RecordFieldPatList {
2496 fn can_cast(kind: SyntaxKind) -> bool { 2096 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST }
2497 match kind {
2498 RECORD_FIELD_PAT_LIST => true,
2499 _ => false,
2500 }
2501 }
2502 fn cast(syntax: SyntaxNode) -> Option<Self> { 2097 fn cast(syntax: SyntaxNode) -> Option<Self> {
2503 if Self::can_cast(syntax.kind()) { 2098 if Self::can_cast(syntax.kind()) {
2504 Some(Self { syntax }) 2099 Some(Self { syntax })
@@ -2528,12 +2123,7 @@ impl std::fmt::Display for RecordFieldPat {
2528 } 2123 }
2529} 2124}
2530impl AstNode for RecordFieldPat { 2125impl AstNode for RecordFieldPat {
2531 fn can_cast(kind: SyntaxKind) -> bool { 2126 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT }
2532 match kind {
2533 RECORD_FIELD_PAT => true,
2534 _ => false,
2535 }
2536 }
2537 fn cast(syntax: SyntaxNode) -> Option<Self> { 2127 fn cast(syntax: SyntaxNode) -> Option<Self> {
2538 if Self::can_cast(syntax.kind()) { 2128 if Self::can_cast(syntax.kind()) {
2539 Some(Self { syntax }) 2129 Some(Self { syntax })
@@ -2559,12 +2149,7 @@ impl std::fmt::Display for TupleStructPat {
2559 } 2149 }
2560} 2150}
2561impl AstNode for TupleStructPat { 2151impl AstNode for TupleStructPat {
2562 fn can_cast(kind: SyntaxKind) -> bool { 2152 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT }
2563 match kind {
2564 TUPLE_STRUCT_PAT => true,
2565 _ => false,
2566 }
2567 }
2568 fn cast(syntax: SyntaxNode) -> Option<Self> { 2153 fn cast(syntax: SyntaxNode) -> Option<Self> {
2569 if Self::can_cast(syntax.kind()) { 2154 if Self::can_cast(syntax.kind()) {
2570 Some(Self { syntax }) 2155 Some(Self { syntax })
@@ -2590,12 +2175,7 @@ impl std::fmt::Display for TuplePat {
2590 } 2175 }
2591} 2176}
2592impl AstNode for TuplePat { 2177impl AstNode for TuplePat {
2593 fn can_cast(kind: SyntaxKind) -> bool { 2178 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT }
2594 match kind {
2595 TUPLE_PAT => true,
2596 _ => false,
2597 }
2598 }
2599 fn cast(syntax: SyntaxNode) -> Option<Self> { 2179 fn cast(syntax: SyntaxNode) -> Option<Self> {
2600 if Self::can_cast(syntax.kind()) { 2180 if Self::can_cast(syntax.kind()) {
2601 Some(Self { syntax }) 2181 Some(Self { syntax })
@@ -2620,12 +2200,7 @@ impl std::fmt::Display for Visibility {
2620 } 2200 }
2621} 2201}
2622impl AstNode for Visibility { 2202impl AstNode for Visibility {
2623 fn can_cast(kind: SyntaxKind) -> bool { 2203 fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY }
2624 match kind {
2625 VISIBILITY => true,
2626 _ => false,
2627 }
2628 }
2629 fn cast(syntax: SyntaxNode) -> Option<Self> { 2204 fn cast(syntax: SyntaxNode) -> Option<Self> {
2630 if Self::can_cast(syntax.kind()) { 2205 if Self::can_cast(syntax.kind()) {
2631 Some(Self { syntax }) 2206 Some(Self { syntax })
@@ -2651,12 +2226,7 @@ impl std::fmt::Display for Name {
2651 } 2226 }
2652} 2227}
2653impl AstNode for Name { 2228impl AstNode for Name {
2654 fn can_cast(kind: SyntaxKind) -> bool { 2229 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
2655 match kind {
2656 NAME => true,
2657 _ => false,
2658 }
2659 }
2660 fn cast(syntax: SyntaxNode) -> Option<Self> { 2230 fn cast(syntax: SyntaxNode) -> Option<Self> {
2661 if Self::can_cast(syntax.kind()) { 2231 if Self::can_cast(syntax.kind()) {
2662 Some(Self { syntax }) 2232 Some(Self { syntax })
@@ -2679,12 +2249,7 @@ impl std::fmt::Display for NameRef {
2679 } 2249 }
2680} 2250}
2681impl AstNode for NameRef { 2251impl AstNode for NameRef {
2682 fn can_cast(kind: SyntaxKind) -> bool { 2252 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
2683 match kind {
2684 NAME_REF => true,
2685 _ => false,
2686 }
2687 }
2688 fn cast(syntax: SyntaxNode) -> Option<Self> { 2253 fn cast(syntax: SyntaxNode) -> Option<Self> {
2689 if Self::can_cast(syntax.kind()) { 2254 if Self::can_cast(syntax.kind()) {
2690 Some(Self { syntax }) 2255 Some(Self { syntax })
@@ -2707,12 +2272,7 @@ impl std::fmt::Display for MacroCall {
2707 } 2272 }
2708} 2273}
2709impl AstNode for MacroCall { 2274impl AstNode for MacroCall {
2710 fn can_cast(kind: SyntaxKind) -> bool { 2275 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL }
2711 match kind {
2712 MACRO_CALL => true,
2713 _ => false,
2714 }
2715 }
2716 fn cast(syntax: SyntaxNode) -> Option<Self> { 2276 fn cast(syntax: SyntaxNode) -> Option<Self> {
2717 if Self::can_cast(syntax.kind()) { 2277 if Self::can_cast(syntax.kind()) {
2718 Some(Self { syntax }) 2278 Some(Self { syntax })
@@ -2741,12 +2301,7 @@ impl std::fmt::Display for Attr {
2741 } 2301 }
2742} 2302}
2743impl AstNode for Attr { 2303impl AstNode for Attr {
2744 fn can_cast(kind: SyntaxKind) -> bool { 2304 fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR }
2745 match kind {
2746 ATTR => true,
2747 _ => false,
2748 }
2749 }
2750 fn cast(syntax: SyntaxNode) -> Option<Self> { 2305 fn cast(syntax: SyntaxNode) -> Option<Self> {
2751 if Self::can_cast(syntax.kind()) { 2306 if Self::can_cast(syntax.kind()) {
2752 Some(Self { syntax }) 2307 Some(Self { syntax })
@@ -2775,12 +2330,7 @@ impl std::fmt::Display for TokenTree {
2775 } 2330 }
2776} 2331}
2777impl AstNode for TokenTree { 2332impl AstNode for TokenTree {
2778 fn can_cast(kind: SyntaxKind) -> bool { 2333 fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE }
2779 match kind {
2780 TOKEN_TREE => true,
2781 _ => false,
2782 }
2783 }
2784 fn cast(syntax: SyntaxNode) -> Option<Self> { 2334 fn cast(syntax: SyntaxNode) -> Option<Self> {
2785 if Self::can_cast(syntax.kind()) { 2335 if Self::can_cast(syntax.kind()) {
2786 Some(Self { syntax }) 2336 Some(Self { syntax })
@@ -2801,12 +2351,7 @@ impl std::fmt::Display for TypeParamList {
2801 } 2351 }
2802} 2352}
2803impl AstNode for TypeParamList { 2353impl AstNode for TypeParamList {
2804 fn can_cast(kind: SyntaxKind) -> bool { 2354 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST }
2805 match kind {
2806 TYPE_PARAM_LIST => true,
2807 _ => false,
2808 }
2809 }
2810 fn cast(syntax: SyntaxNode) -> Option<Self> { 2355 fn cast(syntax: SyntaxNode) -> Option<Self> {
2811 if Self::can_cast(syntax.kind()) { 2356 if Self::can_cast(syntax.kind()) {
2812 Some(Self { syntax }) 2357 Some(Self { syntax })
@@ -2834,12 +2379,7 @@ impl std::fmt::Display for TypeParam {
2834 } 2379 }
2835} 2380}
2836impl AstNode for TypeParam { 2381impl AstNode for TypeParam {
2837 fn can_cast(kind: SyntaxKind) -> bool { 2382 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM }
2838 match kind {
2839 TYPE_PARAM => true,
2840 _ => false,
2841 }
2842 }
2843 fn cast(syntax: SyntaxNode) -> Option<Self> { 2383 fn cast(syntax: SyntaxNode) -> Option<Self> {
2844 if Self::can_cast(syntax.kind()) { 2384 if Self::can_cast(syntax.kind()) {
2845 Some(Self { syntax }) 2385 Some(Self { syntax })
@@ -2866,12 +2406,7 @@ impl std::fmt::Display for ConstParam {
2866 } 2406 }
2867} 2407}
2868impl AstNode for ConstParam { 2408impl AstNode for ConstParam {
2869 fn can_cast(kind: SyntaxKind) -> bool { 2409 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM }
2870 match kind {
2871 CONST_PARAM => true,
2872 _ => false,
2873 }
2874 }
2875 fn cast(syntax: SyntaxNode) -> Option<Self> { 2410 fn cast(syntax: SyntaxNode) -> Option<Self> {
2876 if Self::can_cast(syntax.kind()) { 2411 if Self::can_cast(syntax.kind()) {
2877 Some(Self { syntax }) 2412 Some(Self { syntax })
@@ -2898,12 +2433,7 @@ impl std::fmt::Display for LifetimeParam {
2898 } 2433 }
2899} 2434}
2900impl AstNode for LifetimeParam { 2435impl AstNode for LifetimeParam {
2901 fn can_cast(kind: SyntaxKind) -> bool { 2436 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM }
2902 match kind {
2903 LIFETIME_PARAM => true,
2904 _ => false,
2905 }
2906 }
2907 fn cast(syntax: SyntaxNode) -> Option<Self> { 2437 fn cast(syntax: SyntaxNode) -> Option<Self> {
2908 if Self::can_cast(syntax.kind()) { 2438 if Self::can_cast(syntax.kind()) {
2909 Some(Self { syntax }) 2439 Some(Self { syntax })
@@ -2927,12 +2457,7 @@ impl std::fmt::Display for TypeBound {
2927 } 2457 }
2928} 2458}
2929impl AstNode for TypeBound { 2459impl AstNode for TypeBound {
2930 fn can_cast(kind: SyntaxKind) -> bool { 2460 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND }
2931 match kind {
2932 TYPE_BOUND => true,
2933 _ => false,
2934 }
2935 }
2936 fn cast(syntax: SyntaxNode) -> Option<Self> { 2461 fn cast(syntax: SyntaxNode) -> Option<Self> {
2937 if Self::can_cast(syntax.kind()) { 2462 if Self::can_cast(syntax.kind()) {
2938 Some(Self { syntax }) 2463 Some(Self { syntax })
@@ -2957,12 +2482,7 @@ impl std::fmt::Display for TypeBoundList {
2957 } 2482 }
2958} 2483}
2959impl AstNode for TypeBoundList { 2484impl AstNode for TypeBoundList {
2960 fn can_cast(kind: SyntaxKind) -> bool { 2485 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
2961 match kind {
2962 TYPE_BOUND_LIST => true,
2963 _ => false,
2964 }
2965 }
2966 fn cast(syntax: SyntaxNode) -> Option<Self> { 2486 fn cast(syntax: SyntaxNode) -> Option<Self> {
2967 if Self::can_cast(syntax.kind()) { 2487 if Self::can_cast(syntax.kind()) {
2968 Some(Self { syntax }) 2488 Some(Self { syntax })
@@ -2985,12 +2505,7 @@ impl std::fmt::Display for WherePred {
2985 } 2505 }
2986} 2506}
2987impl AstNode for WherePred { 2507impl AstNode for WherePred {
2988 fn can_cast(kind: SyntaxKind) -> bool { 2508 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED }
2989 match kind {
2990 WHERE_PRED => true,
2991 _ => false,
2992 }
2993 }
2994 fn cast(syntax: SyntaxNode) -> Option<Self> { 2509 fn cast(syntax: SyntaxNode) -> Option<Self> {
2995 if Self::can_cast(syntax.kind()) { 2510 if Self::can_cast(syntax.kind()) {
2996 Some(Self { syntax }) 2511 Some(Self { syntax })
@@ -3015,12 +2530,7 @@ impl std::fmt::Display for WhereClause {
3015 } 2530 }
3016} 2531}
3017impl AstNode for WhereClause { 2532impl AstNode for WhereClause {
3018 fn can_cast(kind: SyntaxKind) -> bool { 2533 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE }
3019 match kind {
3020 WHERE_CLAUSE => true,
3021 _ => false,
3022 }
3023 }
3024 fn cast(syntax: SyntaxNode) -> Option<Self> { 2534 fn cast(syntax: SyntaxNode) -> Option<Self> {
3025 if Self::can_cast(syntax.kind()) { 2535 if Self::can_cast(syntax.kind()) {
3026 Some(Self { syntax }) 2536 Some(Self { syntax })
@@ -3044,12 +2554,7 @@ impl std::fmt::Display for Abi {
3044 } 2554 }
3045} 2555}
3046impl AstNode for Abi { 2556impl AstNode for Abi {
3047 fn can_cast(kind: SyntaxKind) -> bool { 2557 fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
3048 match kind {
3049 ABI => true,
3050 _ => false,
3051 }
3052 }
3053 fn cast(syntax: SyntaxNode) -> Option<Self> { 2558 fn cast(syntax: SyntaxNode) -> Option<Self> {
3054 if Self::can_cast(syntax.kind()) { 2559 if Self::can_cast(syntax.kind()) {
3055 Some(Self { syntax }) 2560 Some(Self { syntax })
@@ -3072,12 +2577,7 @@ impl std::fmt::Display for ExprStmt {
3072 } 2577 }
3073} 2578}
3074impl AstNode for ExprStmt { 2579impl AstNode for ExprStmt {
3075 fn can_cast(kind: SyntaxKind) -> bool { 2580 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
3076 match kind {
3077 EXPR_STMT => true,
3078 _ => false,
3079 }
3080 }
3081 fn cast(syntax: SyntaxNode) -> Option<Self> { 2581 fn cast(syntax: SyntaxNode) -> Option<Self> {
3082 if Self::can_cast(syntax.kind()) { 2582 if Self::can_cast(syntax.kind()) {
3083 Some(Self { syntax }) 2583 Some(Self { syntax })
@@ -3102,12 +2602,7 @@ impl std::fmt::Display for LetStmt {
3102 } 2602 }
3103} 2603}
3104impl AstNode for LetStmt { 2604impl AstNode for LetStmt {
3105 fn can_cast(kind: SyntaxKind) -> bool { 2605 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT }
3106 match kind {
3107 LET_STMT => true,
3108 _ => false,
3109 }
3110 }
3111 fn cast(syntax: SyntaxNode) -> Option<Self> { 2606 fn cast(syntax: SyntaxNode) -> Option<Self> {
3112 if Self::can_cast(syntax.kind()) { 2607 if Self::can_cast(syntax.kind()) {
3113 Some(Self { syntax }) 2608 Some(Self { syntax })
@@ -3135,12 +2630,7 @@ impl std::fmt::Display for Condition {
3135 } 2630 }
3136} 2631}
3137impl AstNode for Condition { 2632impl AstNode for Condition {
3138 fn can_cast(kind: SyntaxKind) -> bool { 2633 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION }
3139 match kind {
3140 CONDITION => true,
3141 _ => false,
3142 }
3143 }
3144 fn cast(syntax: SyntaxNode) -> Option<Self> { 2634 fn cast(syntax: SyntaxNode) -> Option<Self> {
3145 if Self::can_cast(syntax.kind()) { 2635 if Self::can_cast(syntax.kind()) {
3146 Some(Self { syntax }) 2636 Some(Self { syntax })
@@ -3166,12 +2656,7 @@ impl std::fmt::Display for Block {
3166 } 2656 }
3167} 2657}
3168impl AstNode for Block { 2658impl AstNode for Block {
3169 fn can_cast(kind: SyntaxKind) -> bool { 2659 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK }
3170 match kind {
3171 BLOCK => true,
3172 _ => false,
3173 }
3174 }
3175 fn cast(syntax: SyntaxNode) -> Option<Self> { 2660 fn cast(syntax: SyntaxNode) -> Option<Self> {
3176 if Self::can_cast(syntax.kind()) { 2661 if Self::can_cast(syntax.kind()) {
3177 Some(Self { syntax }) 2662 Some(Self { syntax })
@@ -3199,12 +2684,7 @@ impl std::fmt::Display for ParamList {
3199 } 2684 }
3200} 2685}
3201impl AstNode for ParamList { 2686impl AstNode for ParamList {
3202 fn can_cast(kind: SyntaxKind) -> bool { 2687 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
3203 match kind {
3204 PARAM_LIST => true,
3205 _ => false,
3206 }
3207 }
3208 fn cast(syntax: SyntaxNode) -> Option<Self> { 2688 fn cast(syntax: SyntaxNode) -> Option<Self> {
3209 if Self::can_cast(syntax.kind()) { 2689 if Self::can_cast(syntax.kind()) {
3210 Some(Self { syntax }) 2690 Some(Self { syntax })
@@ -3230,12 +2710,7 @@ impl std::fmt::Display for SelfParam {
3230 } 2710 }
3231} 2711}
3232impl AstNode for SelfParam { 2712impl AstNode for SelfParam {
3233 fn can_cast(kind: SyntaxKind) -> bool { 2713 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
3234 match kind {
3235 SELF_PARAM => true,
3236 _ => false,
3237 }
3238 }
3239 fn cast(syntax: SyntaxNode) -> Option<Self> { 2714 fn cast(syntax: SyntaxNode) -> Option<Self> {
3240 if Self::can_cast(syntax.kind()) { 2715 if Self::can_cast(syntax.kind()) {
3241 Some(Self { syntax }) 2716 Some(Self { syntax })
@@ -3262,12 +2737,7 @@ impl std::fmt::Display for Param {
3262 } 2737 }
3263} 2738}
3264impl AstNode for Param { 2739impl AstNode for Param {
3265 fn can_cast(kind: SyntaxKind) -> bool { 2740 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
3266 match kind {
3267 PARAM => true,
3268 _ => false,
3269 }
3270 }
3271 fn cast(syntax: SyntaxNode) -> Option<Self> { 2741 fn cast(syntax: SyntaxNode) -> Option<Self> {
3272 if Self::can_cast(syntax.kind()) { 2742 if Self::can_cast(syntax.kind()) {
3273 Some(Self { syntax }) 2743 Some(Self { syntax })
@@ -3293,12 +2763,7 @@ impl std::fmt::Display for UseItem {
3293 } 2763 }
3294} 2764}
3295impl AstNode for UseItem { 2765impl AstNode for UseItem {
3296 fn can_cast(kind: SyntaxKind) -> bool { 2766 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM }
3297 match kind {
3298 USE_ITEM => true,
3299 _ => false,
3300 }
3301 }
3302 fn cast(syntax: SyntaxNode) -> Option<Self> { 2767 fn cast(syntax: SyntaxNode) -> Option<Self> {
3303 if Self::can_cast(syntax.kind()) { 2768 if Self::can_cast(syntax.kind()) {
3304 Some(Self { syntax }) 2769 Some(Self { syntax })
@@ -3324,12 +2789,7 @@ impl std::fmt::Display for UseTree {
3324 } 2789 }
3325} 2790}
3326impl AstNode for UseTree { 2791impl AstNode for UseTree {
3327 fn can_cast(kind: SyntaxKind) -> bool { 2792 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE }
3328 match kind {
3329 USE_TREE => true,
3330 _ => false,
3331 }
3332 }
3333 fn cast(syntax: SyntaxNode) -> Option<Self> { 2793 fn cast(syntax: SyntaxNode) -> Option<Self> {
3334 if Self::can_cast(syntax.kind()) { 2794 if Self::can_cast(syntax.kind()) {
3335 Some(Self { syntax }) 2795 Some(Self { syntax })
@@ -3355,12 +2815,7 @@ impl std::fmt::Display for Alias {
3355 } 2815 }
3356} 2816}
3357impl AstNode for Alias { 2817impl AstNode for Alias {
3358 fn can_cast(kind: SyntaxKind) -> bool { 2818 fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS }
3359 match kind {
3360 ALIAS => true,
3361 _ => false,
3362 }
3363 }
3364 fn cast(syntax: SyntaxNode) -> Option<Self> { 2819 fn cast(syntax: SyntaxNode) -> Option<Self> {
3365 if Self::can_cast(syntax.kind()) { 2820 if Self::can_cast(syntax.kind()) {
3366 Some(Self { syntax }) 2821 Some(Self { syntax })
@@ -3384,12 +2839,7 @@ impl std::fmt::Display for UseTreeList {
3384 } 2839 }
3385} 2840}
3386impl AstNode for UseTreeList { 2841impl AstNode for UseTreeList {
3387 fn can_cast(kind: SyntaxKind) -> bool { 2842 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST }
3388 match kind {
3389 USE_TREE_LIST => true,
3390 _ => false,
3391 }
3392 }
3393 fn cast(syntax: SyntaxNode) -> Option<Self> { 2843 fn cast(syntax: SyntaxNode) -> Option<Self> {
3394 if Self::can_cast(syntax.kind()) { 2844 if Self::can_cast(syntax.kind()) {
3395 Some(Self { syntax }) 2845 Some(Self { syntax })
@@ -3414,12 +2864,7 @@ impl std::fmt::Display for ExternCrateItem {
3414 } 2864 }
3415} 2865}
3416impl AstNode for ExternCrateItem { 2866impl AstNode for ExternCrateItem {
3417 fn can_cast(kind: SyntaxKind) -> bool { 2867 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM }
3418 match kind {
3419 EXTERN_CRATE_ITEM => true,
3420 _ => false,
3421 }
3422 }
3423 fn cast(syntax: SyntaxNode) -> Option<Self> { 2868 fn cast(syntax: SyntaxNode) -> Option<Self> {
3424 if Self::can_cast(syntax.kind()) { 2869 if Self::can_cast(syntax.kind()) {
3425 Some(Self { syntax }) 2870 Some(Self { syntax })
@@ -3447,12 +2892,7 @@ impl std::fmt::Display for ArgList {
3447 } 2892 }
3448} 2893}
3449impl AstNode for ArgList { 2894impl AstNode for ArgList {
3450 fn can_cast(kind: SyntaxKind) -> bool { 2895 fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST }
3451 match kind {
3452 ARG_LIST => true,
3453 _ => false,
3454 }
3455 }
3456 fn cast(syntax: SyntaxNode) -> Option<Self> { 2896 fn cast(syntax: SyntaxNode) -> Option<Self> {
3457 if Self::can_cast(syntax.kind()) { 2897 if Self::can_cast(syntax.kind()) {
3458 Some(Self { syntax }) 2898 Some(Self { syntax })
@@ -3477,12 +2917,7 @@ impl std::fmt::Display for Path {
3477 } 2917 }
3478} 2918}
3479impl AstNode for Path { 2919impl AstNode for Path {
3480 fn can_cast(kind: SyntaxKind) -> bool { 2920 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
3481 match kind {
3482 PATH => true,
3483 _ => false,
3484 }
3485 }
3486 fn cast(syntax: SyntaxNode) -> Option<Self> { 2921 fn cast(syntax: SyntaxNode) -> Option<Self> {
3487 if Self::can_cast(syntax.kind()) { 2922 if Self::can_cast(syntax.kind()) {
3488 Some(Self { syntax }) 2923 Some(Self { syntax })
@@ -3506,12 +2941,7 @@ impl std::fmt::Display for PathSegment {
3506 } 2941 }
3507} 2942}
3508impl AstNode for PathSegment { 2943impl AstNode for PathSegment {
3509 fn can_cast(kind: SyntaxKind) -> bool { 2944 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
3510 match kind {
3511 PATH_SEGMENT => true,
3512 _ => false,
3513 }
3514 }
3515 fn cast(syntax: SyntaxNode) -> Option<Self> { 2945 fn cast(syntax: SyntaxNode) -> Option<Self> {
3516 if Self::can_cast(syntax.kind()) { 2946 if Self::can_cast(syntax.kind()) {
3517 Some(Self { syntax }) 2947 Some(Self { syntax })
@@ -3541,12 +2971,7 @@ impl std::fmt::Display for TypeArgList {
3541 } 2971 }
3542} 2972}
3543impl AstNode for TypeArgList { 2973impl AstNode for TypeArgList {
3544 fn can_cast(kind: SyntaxKind) -> bool { 2974 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST }
3545 match kind {
3546 TYPE_ARG_LIST => true,
3547 _ => false,
3548 }
3549 }
3550 fn cast(syntax: SyntaxNode) -> Option<Self> { 2975 fn cast(syntax: SyntaxNode) -> Option<Self> {
3551 if Self::can_cast(syntax.kind()) { 2976 if Self::can_cast(syntax.kind()) {
3552 Some(Self { syntax }) 2977 Some(Self { syntax })
@@ -3576,12 +3001,7 @@ impl std::fmt::Display for TypeArg {
3576 } 3001 }
3577} 3002}
3578impl AstNode for TypeArg { 3003impl AstNode for TypeArg {
3579 fn can_cast(kind: SyntaxKind) -> bool { 3004 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
3580 match kind {
3581 TYPE_ARG => true,
3582 _ => false,
3583 }
3584 }
3585 fn cast(syntax: SyntaxNode) -> Option<Self> { 3005 fn cast(syntax: SyntaxNode) -> Option<Self> {
3586 if Self::can_cast(syntax.kind()) { 3006 if Self::can_cast(syntax.kind()) {
3587 Some(Self { syntax }) 3007 Some(Self { syntax })
@@ -3604,12 +3024,7 @@ impl std::fmt::Display for AssocTypeArg {
3604 } 3024 }
3605} 3025}
3606impl AstNode for AssocTypeArg { 3026impl AstNode for AssocTypeArg {
3607 fn can_cast(kind: SyntaxKind) -> bool { 3027 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
3608 match kind {
3609 ASSOC_TYPE_ARG => true,
3610 _ => false,
3611 }
3612 }
3613 fn cast(syntax: SyntaxNode) -> Option<Self> { 3028 fn cast(syntax: SyntaxNode) -> Option<Self> {
3614 if Self::can_cast(syntax.kind()) { 3029 if Self::can_cast(syntax.kind()) {
3615 Some(Self { syntax }) 3030 Some(Self { syntax })
@@ -3635,12 +3050,7 @@ impl std::fmt::Display for LifetimeArg {
3635 } 3050 }
3636} 3051}
3637impl AstNode for LifetimeArg { 3052impl AstNode for LifetimeArg {
3638 fn can_cast(kind: SyntaxKind) -> bool { 3053 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
3639 match kind {
3640 LIFETIME_ARG => true,
3641 _ => false,
3642 }
3643 }
3644 fn cast(syntax: SyntaxNode) -> Option<Self> { 3054 fn cast(syntax: SyntaxNode) -> Option<Self> {
3645 if Self::can_cast(syntax.kind()) { 3055 if Self::can_cast(syntax.kind()) {
3646 Some(Self { syntax }) 3056 Some(Self { syntax })
@@ -3663,12 +3073,7 @@ impl std::fmt::Display for ConstArg {
3663 } 3073 }
3664} 3074}
3665impl AstNode for ConstArg { 3075impl AstNode for ConstArg {
3666 fn can_cast(kind: SyntaxKind) -> bool { 3076 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
3667 match kind {
3668 CONST_ARG => true,
3669 _ => false,
3670 }
3671 }
3672 fn cast(syntax: SyntaxNode) -> Option<Self> { 3077 fn cast(syntax: SyntaxNode) -> Option<Self> {
3673 if Self::can_cast(syntax.kind()) { 3078 if Self::can_cast(syntax.kind()) {
3674 Some(Self { syntax }) 3079 Some(Self { syntax })
@@ -3693,12 +3098,7 @@ impl std::fmt::Display for MacroItems {
3693 } 3098 }
3694} 3099}
3695impl AstNode for MacroItems { 3100impl AstNode for MacroItems {
3696 fn can_cast(kind: SyntaxKind) -> bool { 3101 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS }
3697 match kind {
3698 MACRO_ITEMS => true,
3699 _ => false,
3700 }
3701 }
3702 fn cast(syntax: SyntaxNode) -> Option<Self> { 3102 fn cast(syntax: SyntaxNode) -> Option<Self> {
3703 if Self::can_cast(syntax.kind()) { 3103 if Self::can_cast(syntax.kind()) {
3704 Some(Self { syntax }) 3104 Some(Self { syntax })
@@ -3721,12 +3121,7 @@ impl std::fmt::Display for MacroStmts {
3721 } 3121 }
3722} 3122}
3723impl AstNode for MacroStmts { 3123impl AstNode for MacroStmts {
3724 fn can_cast(kind: SyntaxKind) -> bool { 3124 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS }
3725 match kind {
3726 MACRO_STMTS => true,
3727 _ => false,
3728 }
3729 }
3730 fn cast(syntax: SyntaxNode) -> Option<Self> { 3125 fn cast(syntax: SyntaxNode) -> Option<Self> {
3731 if Self::can_cast(syntax.kind()) { 3126 if Self::can_cast(syntax.kind()) {
3732 Some(Self { syntax }) 3127 Some(Self { syntax })
@@ -3750,12 +3145,7 @@ impl std::fmt::Display for ExternItemList {
3750 } 3145 }
3751} 3146}
3752impl AstNode for ExternItemList { 3147impl AstNode for ExternItemList {
3753 fn can_cast(kind: SyntaxKind) -> bool { 3148 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST }
3754 match kind {
3755 EXTERN_ITEM_LIST => true,
3756 _ => false,
3757 }
3758 }
3759 fn cast(syntax: SyntaxNode) -> Option<Self> { 3149 fn cast(syntax: SyntaxNode) -> Option<Self> {
3760 if Self::can_cast(syntax.kind()) { 3150 if Self::can_cast(syntax.kind()) {
3761 Some(Self { syntax }) 3151 Some(Self { syntax })
@@ -3782,12 +3172,7 @@ impl std::fmt::Display for ExternBlock {
3782 } 3172 }
3783} 3173}
3784impl AstNode for ExternBlock { 3174impl AstNode for ExternBlock {
3785 fn can_cast(kind: SyntaxKind) -> bool { 3175 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK }
3786 match kind {
3787 EXTERN_BLOCK => true,
3788 _ => false,
3789 }
3790 }
3791 fn cast(syntax: SyntaxNode) -> Option<Self> { 3176 fn cast(syntax: SyntaxNode) -> Option<Self> {
3792 if Self::can_cast(syntax.kind()) { 3177 if Self::can_cast(syntax.kind()) {
3793 Some(Self { syntax }) 3178 Some(Self { syntax })
@@ -3811,12 +3196,7 @@ impl std::fmt::Display for MetaItem {
3811 } 3196 }
3812} 3197}
3813impl AstNode for MetaItem { 3198impl AstNode for MetaItem {
3814 fn can_cast(kind: SyntaxKind) -> bool { 3199 fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM }
3815 match kind {
3816 META_ITEM => true,
3817 _ => false,
3818 }
3819 }
3820 fn cast(syntax: SyntaxNode) -> Option<Self> { 3200 fn cast(syntax: SyntaxNode) -> Option<Self> {
3821 if Self::can_cast(syntax.kind()) { 3201 if Self::can_cast(syntax.kind()) {
3822 Some(Self { syntax }) 3202 Some(Self { syntax })
@@ -3842,12 +3222,7 @@ impl std::fmt::Display for MacroDef {
3842 } 3222 }
3843} 3223}
3844impl AstNode for MacroDef { 3224impl AstNode for MacroDef {
3845 fn can_cast(kind: SyntaxKind) -> bool { 3225 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF }
3846 match kind {
3847 MACRO_DEF => true,
3848 _ => false,
3849 }
3850 }
3851 fn cast(syntax: SyntaxNode) -> Option<Self> { 3226 fn cast(syntax: SyntaxNode) -> Option<Self> {
3852 if Self::can_cast(syntax.kind()) { 3227 if Self::can_cast(syntax.kind()) {
3853 Some(Self { syntax }) 3228 Some(Self { syntax })
diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs
index ec3ca4a5b..e64b8bce6 100644
--- a/crates/ra_syntax/src/ast/generated/tokens.rs
+++ b/crates/ra_syntax/src/ast/generated/tokens.rs
@@ -15,12 +15,7 @@ impl std::fmt::Display for Semi {
15 } 15 }
16} 16}
17impl AstToken for Semi { 17impl AstToken for Semi {
18 fn can_cast(kind: SyntaxKind) -> bool { 18 fn can_cast(kind: SyntaxKind) -> bool { kind == SEMI }
19 match kind {
20 SEMI => true,
21 _ => false,
22 }
23 }
24 fn cast(syntax: SyntaxToken) -> Option<Self> { 19 fn cast(syntax: SyntaxToken) -> Option<Self> {
25 if Self::can_cast(syntax.kind()) { 20 if Self::can_cast(syntax.kind()) {
26 Some(Self { syntax }) 21 Some(Self { syntax })
@@ -40,12 +35,7 @@ impl std::fmt::Display for Comma {
40 } 35 }
41} 36}
42impl AstToken for Comma { 37impl AstToken for Comma {
43 fn can_cast(kind: SyntaxKind) -> bool { 38 fn can_cast(kind: SyntaxKind) -> bool { kind == COMMA }
44 match kind {
45 COMMA => true,
46 _ => false,
47 }
48 }
49 fn cast(syntax: SyntaxToken) -> Option<Self> { 39 fn cast(syntax: SyntaxToken) -> Option<Self> {
50 if Self::can_cast(syntax.kind()) { 40 if Self::can_cast(syntax.kind()) {
51 Some(Self { syntax }) 41 Some(Self { syntax })
@@ -65,12 +55,7 @@ impl std::fmt::Display for LParen {
65 } 55 }
66} 56}
67impl AstToken for LParen { 57impl AstToken for LParen {
68 fn can_cast(kind: SyntaxKind) -> bool { 58 fn can_cast(kind: SyntaxKind) -> bool { kind == L_PAREN }
69 match kind {
70 L_PAREN => true,
71 _ => false,
72 }
73 }
74 fn cast(syntax: SyntaxToken) -> Option<Self> { 59 fn cast(syntax: SyntaxToken) -> Option<Self> {
75 if Self::can_cast(syntax.kind()) { 60 if Self::can_cast(syntax.kind()) {
76 Some(Self { syntax }) 61 Some(Self { syntax })
@@ -90,12 +75,7 @@ impl std::fmt::Display for RParen {
90 } 75 }
91} 76}
92impl AstToken for RParen { 77impl AstToken for RParen {
93 fn can_cast(kind: SyntaxKind) -> bool { 78 fn can_cast(kind: SyntaxKind) -> bool { kind == R_PAREN }
94 match kind {
95 R_PAREN => true,
96 _ => false,
97 }
98 }
99 fn cast(syntax: SyntaxToken) -> Option<Self> { 79 fn cast(syntax: SyntaxToken) -> Option<Self> {
100 if Self::can_cast(syntax.kind()) { 80 if Self::can_cast(syntax.kind()) {
101 Some(Self { syntax }) 81 Some(Self { syntax })
@@ -115,12 +95,7 @@ impl std::fmt::Display for LCurly {
115 } 95 }
116} 96}
117impl AstToken for LCurly { 97impl AstToken for LCurly {
118 fn can_cast(kind: SyntaxKind) -> bool { 98 fn can_cast(kind: SyntaxKind) -> bool { kind == L_CURLY }
119 match kind {
120 L_CURLY => true,
121 _ => false,
122 }
123 }
124 fn cast(syntax: SyntaxToken) -> Option<Self> { 99 fn cast(syntax: SyntaxToken) -> Option<Self> {
125 if Self::can_cast(syntax.kind()) { 100 if Self::can_cast(syntax.kind()) {
126 Some(Self { syntax }) 101 Some(Self { syntax })
@@ -140,12 +115,7 @@ impl std::fmt::Display for RCurly {
140 } 115 }
141} 116}
142impl AstToken for RCurly { 117impl AstToken for RCurly {
143 fn can_cast(kind: SyntaxKind) -> bool { 118 fn can_cast(kind: SyntaxKind) -> bool { kind == R_CURLY }
144 match kind {
145 R_CURLY => true,
146 _ => false,
147 }
148 }
149 fn cast(syntax: SyntaxToken) -> Option<Self> { 119 fn cast(syntax: SyntaxToken) -> Option<Self> {
150 if Self::can_cast(syntax.kind()) { 120 if Self::can_cast(syntax.kind()) {
151 Some(Self { syntax }) 121 Some(Self { syntax })
@@ -165,12 +135,7 @@ impl std::fmt::Display for LBrack {
165 } 135 }
166} 136}
167impl AstToken for LBrack { 137impl AstToken for LBrack {
168 fn can_cast(kind: SyntaxKind) -> bool { 138 fn can_cast(kind: SyntaxKind) -> bool { kind == L_BRACK }
169 match kind {
170 L_BRACK => true,
171 _ => false,
172 }
173 }
174 fn cast(syntax: SyntaxToken) -> Option<Self> { 139 fn cast(syntax: SyntaxToken) -> Option<Self> {
175 if Self::can_cast(syntax.kind()) { 140 if Self::can_cast(syntax.kind()) {
176 Some(Self { syntax }) 141 Some(Self { syntax })
@@ -190,12 +155,7 @@ impl std::fmt::Display for RBrack {
190 } 155 }
191} 156}
192impl AstToken for RBrack { 157impl AstToken for RBrack {
193 fn can_cast(kind: SyntaxKind) -> bool { 158 fn can_cast(kind: SyntaxKind) -> bool { kind == R_BRACK }
194 match kind {
195 R_BRACK => true,
196 _ => false,
197 }
198 }
199 fn cast(syntax: SyntaxToken) -> Option<Self> { 159 fn cast(syntax: SyntaxToken) -> Option<Self> {
200 if Self::can_cast(syntax.kind()) { 160 if Self::can_cast(syntax.kind()) {
201 Some(Self { syntax }) 161 Some(Self { syntax })
@@ -215,12 +175,7 @@ impl std::fmt::Display for LAngle {
215 } 175 }
216} 176}
217impl AstToken for LAngle { 177impl AstToken for LAngle {
218 fn can_cast(kind: SyntaxKind) -> bool { 178 fn can_cast(kind: SyntaxKind) -> bool { kind == L_ANGLE }
219 match kind {
220 L_ANGLE => true,
221 _ => false,
222 }
223 }
224 fn cast(syntax: SyntaxToken) -> Option<Self> { 179 fn cast(syntax: SyntaxToken) -> Option<Self> {
225 if Self::can_cast(syntax.kind()) { 180 if Self::can_cast(syntax.kind()) {
226 Some(Self { syntax }) 181 Some(Self { syntax })
@@ -240,12 +195,7 @@ impl std::fmt::Display for RAngle {
240 } 195 }
241} 196}
242impl AstToken for RAngle { 197impl AstToken for RAngle {
243 fn can_cast(kind: SyntaxKind) -> bool { 198 fn can_cast(kind: SyntaxKind) -> bool { kind == R_ANGLE }
244 match kind {
245 R_ANGLE => true,
246 _ => false,
247 }
248 }
249 fn cast(syntax: SyntaxToken) -> Option<Self> { 199 fn cast(syntax: SyntaxToken) -> Option<Self> {
250 if Self::can_cast(syntax.kind()) { 200 if Self::can_cast(syntax.kind()) {
251 Some(Self { syntax }) 201 Some(Self { syntax })
@@ -265,12 +215,7 @@ impl std::fmt::Display for At {
265 } 215 }
266} 216}
267impl AstToken for At { 217impl AstToken for At {
268 fn can_cast(kind: SyntaxKind) -> bool { 218 fn can_cast(kind: SyntaxKind) -> bool { kind == AT }
269 match kind {
270 AT => true,
271 _ => false,
272 }
273 }
274 fn cast(syntax: SyntaxToken) -> Option<Self> { 219 fn cast(syntax: SyntaxToken) -> Option<Self> {
275 if Self::can_cast(syntax.kind()) { 220 if Self::can_cast(syntax.kind()) {
276 Some(Self { syntax }) 221 Some(Self { syntax })
@@ -290,12 +235,7 @@ impl std::fmt::Display for Pound {
290 } 235 }
291} 236}
292impl AstToken for Pound { 237impl AstToken for Pound {
293 fn can_cast(kind: SyntaxKind) -> bool { 238 fn can_cast(kind: SyntaxKind) -> bool { kind == POUND }
294 match kind {
295 POUND => true,
296 _ => false,
297 }
298 }
299 fn cast(syntax: SyntaxToken) -> Option<Self> { 239 fn cast(syntax: SyntaxToken) -> Option<Self> {
300 if Self::can_cast(syntax.kind()) { 240 if Self::can_cast(syntax.kind()) {
301 Some(Self { syntax }) 241 Some(Self { syntax })
@@ -315,12 +255,7 @@ impl std::fmt::Display for Tilde {
315 } 255 }
316} 256}
317impl AstToken for Tilde { 257impl AstToken for Tilde {
318 fn can_cast(kind: SyntaxKind) -> bool { 258 fn can_cast(kind: SyntaxKind) -> bool { kind == TILDE }
319 match kind {
320 TILDE => true,
321 _ => false,
322 }
323 }
324 fn cast(syntax: SyntaxToken) -> Option<Self> { 259 fn cast(syntax: SyntaxToken) -> Option<Self> {
325 if Self::can_cast(syntax.kind()) { 260 if Self::can_cast(syntax.kind()) {
326 Some(Self { syntax }) 261 Some(Self { syntax })
@@ -340,12 +275,7 @@ impl std::fmt::Display for Question {
340 } 275 }
341} 276}
342impl AstToken for Question { 277impl AstToken for Question {
343 fn can_cast(kind: SyntaxKind) -> bool { 278 fn can_cast(kind: SyntaxKind) -> bool { kind == QUESTION }
344 match kind {
345 QUESTION => true,
346 _ => false,
347 }
348 }
349 fn cast(syntax: SyntaxToken) -> Option<Self> { 279 fn cast(syntax: SyntaxToken) -> Option<Self> {
350 if Self::can_cast(syntax.kind()) { 280 if Self::can_cast(syntax.kind()) {
351 Some(Self { syntax }) 281 Some(Self { syntax })
@@ -365,12 +295,7 @@ impl std::fmt::Display for Dollar {
365 } 295 }
366} 296}
367impl AstToken for Dollar { 297impl AstToken for Dollar {
368 fn can_cast(kind: SyntaxKind) -> bool { 298 fn can_cast(kind: SyntaxKind) -> bool { kind == DOLLAR }
369 match kind {
370 DOLLAR => true,
371 _ => false,
372 }
373 }
374 fn cast(syntax: SyntaxToken) -> Option<Self> { 299 fn cast(syntax: SyntaxToken) -> Option<Self> {
375 if Self::can_cast(syntax.kind()) { 300 if Self::can_cast(syntax.kind()) {
376 Some(Self { syntax }) 301 Some(Self { syntax })
@@ -390,12 +315,7 @@ impl std::fmt::Display for Amp {
390 } 315 }
391} 316}
392impl AstToken for Amp { 317impl AstToken for Amp {
393 fn can_cast(kind: SyntaxKind) -> bool { 318 fn can_cast(kind: SyntaxKind) -> bool { kind == AMP }
394 match kind {
395 AMP => true,
396 _ => false,
397 }
398 }
399 fn cast(syntax: SyntaxToken) -> Option<Self> { 319 fn cast(syntax: SyntaxToken) -> Option<Self> {
400 if Self::can_cast(syntax.kind()) { 320 if Self::can_cast(syntax.kind()) {
401 Some(Self { syntax }) 321 Some(Self { syntax })
@@ -415,12 +335,7 @@ impl std::fmt::Display for Pipe {
415 } 335 }
416} 336}
417impl AstToken for Pipe { 337impl AstToken for Pipe {
418 fn can_cast(kind: SyntaxKind) -> bool { 338 fn can_cast(kind: SyntaxKind) -> bool { kind == PIPE }
419 match kind {
420 PIPE => true,
421 _ => false,
422 }
423 }
424 fn cast(syntax: SyntaxToken) -> Option<Self> { 339 fn cast(syntax: SyntaxToken) -> Option<Self> {
425 if Self::can_cast(syntax.kind()) { 340 if Self::can_cast(syntax.kind()) {
426 Some(Self { syntax }) 341 Some(Self { syntax })
@@ -440,12 +355,7 @@ impl std::fmt::Display for Plus {
440 } 355 }
441} 356}
442impl AstToken for Plus { 357impl AstToken for Plus {
443 fn can_cast(kind: SyntaxKind) -> bool { 358 fn can_cast(kind: SyntaxKind) -> bool { kind == PLUS }
444 match kind {
445 PLUS => true,
446 _ => false,
447 }
448 }
449 fn cast(syntax: SyntaxToken) -> Option<Self> { 359 fn cast(syntax: SyntaxToken) -> Option<Self> {
450 if Self::can_cast(syntax.kind()) { 360 if Self::can_cast(syntax.kind()) {
451 Some(Self { syntax }) 361 Some(Self { syntax })
@@ -465,12 +375,7 @@ impl std::fmt::Display for Star {
465 } 375 }
466} 376}
467impl AstToken for Star { 377impl AstToken for Star {
468 fn can_cast(kind: SyntaxKind) -> bool { 378 fn can_cast(kind: SyntaxKind) -> bool { kind == STAR }
469 match kind {
470 STAR => true,
471 _ => false,
472 }
473 }
474 fn cast(syntax: SyntaxToken) -> Option<Self> { 379 fn cast(syntax: SyntaxToken) -> Option<Self> {
475 if Self::can_cast(syntax.kind()) { 380 if Self::can_cast(syntax.kind()) {
476 Some(Self { syntax }) 381 Some(Self { syntax })
@@ -490,12 +395,7 @@ impl std::fmt::Display for Slash {
490 } 395 }
491} 396}
492impl AstToken for Slash { 397impl AstToken for Slash {
493 fn can_cast(kind: SyntaxKind) -> bool { 398 fn can_cast(kind: SyntaxKind) -> bool { kind == SLASH }
494 match kind {
495 SLASH => true,
496 _ => false,
497 }
498 }
499 fn cast(syntax: SyntaxToken) -> Option<Self> { 399 fn cast(syntax: SyntaxToken) -> Option<Self> {
500 if Self::can_cast(syntax.kind()) { 400 if Self::can_cast(syntax.kind()) {
501 Some(Self { syntax }) 401 Some(Self { syntax })
@@ -515,12 +415,7 @@ impl std::fmt::Display for Caret {
515 } 415 }
516} 416}
517impl AstToken for Caret { 417impl AstToken for Caret {
518 fn can_cast(kind: SyntaxKind) -> bool { 418 fn can_cast(kind: SyntaxKind) -> bool { kind == CARET }
519 match kind {
520 CARET => true,
521 _ => false,
522 }
523 }
524 fn cast(syntax: SyntaxToken) -> Option<Self> { 419 fn cast(syntax: SyntaxToken) -> Option<Self> {
525 if Self::can_cast(syntax.kind()) { 420 if Self::can_cast(syntax.kind()) {
526 Some(Self { syntax }) 421 Some(Self { syntax })
@@ -540,12 +435,7 @@ impl std::fmt::Display for Percent {
540 } 435 }
541} 436}
542impl AstToken for Percent { 437impl AstToken for Percent {
543 fn can_cast(kind: SyntaxKind) -> bool { 438 fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENT }
544 match kind {
545 PERCENT => true,
546 _ => false,
547 }
548 }
549 fn cast(syntax: SyntaxToken) -> Option<Self> { 439 fn cast(syntax: SyntaxToken) -> Option<Self> {
550 if Self::can_cast(syntax.kind()) { 440 if Self::can_cast(syntax.kind()) {
551 Some(Self { syntax }) 441 Some(Self { syntax })
@@ -565,12 +455,7 @@ impl std::fmt::Display for Underscore {
565 } 455 }
566} 456}
567impl AstToken for Underscore { 457impl AstToken for Underscore {
568 fn can_cast(kind: SyntaxKind) -> bool { 458 fn can_cast(kind: SyntaxKind) -> bool { kind == UNDERSCORE }
569 match kind {
570 UNDERSCORE => true,
571 _ => false,
572 }
573 }
574 fn cast(syntax: SyntaxToken) -> Option<Self> { 459 fn cast(syntax: SyntaxToken) -> Option<Self> {
575 if Self::can_cast(syntax.kind()) { 460 if Self::can_cast(syntax.kind()) {
576 Some(Self { syntax }) 461 Some(Self { syntax })
@@ -590,12 +475,7 @@ impl std::fmt::Display for Dot {
590 } 475 }
591} 476}
592impl AstToken for Dot { 477impl AstToken for Dot {
593 fn can_cast(kind: SyntaxKind) -> bool { 478 fn can_cast(kind: SyntaxKind) -> bool { kind == DOT }
594 match kind {
595 DOT => true,
596 _ => false,
597 }
598 }
599 fn cast(syntax: SyntaxToken) -> Option<Self> { 479 fn cast(syntax: SyntaxToken) -> Option<Self> {
600 if Self::can_cast(syntax.kind()) { 480 if Self::can_cast(syntax.kind()) {
601 Some(Self { syntax }) 481 Some(Self { syntax })
@@ -615,12 +495,7 @@ impl std::fmt::Display for Dotdot {
615 } 495 }
616} 496}
617impl AstToken for Dotdot { 497impl AstToken for Dotdot {
618 fn can_cast(kind: SyntaxKind) -> bool { 498 fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOT }
619 match kind {
620 DOTDOT => true,
621 _ => false,
622 }
623 }
624 fn cast(syntax: SyntaxToken) -> Option<Self> { 499 fn cast(syntax: SyntaxToken) -> Option<Self> {
625 if Self::can_cast(syntax.kind()) { 500 if Self::can_cast(syntax.kind()) {
626 Some(Self { syntax }) 501 Some(Self { syntax })
@@ -640,12 +515,7 @@ impl std::fmt::Display for Dotdotdot {
640 } 515 }
641} 516}
642impl AstToken for Dotdotdot { 517impl AstToken for Dotdotdot {
643 fn can_cast(kind: SyntaxKind) -> bool { 518 fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTDOT }
644 match kind {
645 DOTDOTDOT => true,
646 _ => false,
647 }
648 }
649 fn cast(syntax: SyntaxToken) -> Option<Self> { 519 fn cast(syntax: SyntaxToken) -> Option<Self> {
650 if Self::can_cast(syntax.kind()) { 520 if Self::can_cast(syntax.kind()) {
651 Some(Self { syntax }) 521 Some(Self { syntax })
@@ -665,12 +535,7 @@ impl std::fmt::Display for Dotdoteq {
665 } 535 }
666} 536}
667impl AstToken for Dotdoteq { 537impl AstToken for Dotdoteq {
668 fn can_cast(kind: SyntaxKind) -> bool { 538 fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTEQ }
669 match kind {
670 DOTDOTEQ => true,
671 _ => false,
672 }
673 }
674 fn cast(syntax: SyntaxToken) -> Option<Self> { 539 fn cast(syntax: SyntaxToken) -> Option<Self> {
675 if Self::can_cast(syntax.kind()) { 540 if Self::can_cast(syntax.kind()) {
676 Some(Self { syntax }) 541 Some(Self { syntax })
@@ -690,12 +555,7 @@ impl std::fmt::Display for Colon {
690 } 555 }
691} 556}
692impl AstToken for Colon { 557impl AstToken for Colon {
693 fn can_cast(kind: SyntaxKind) -> bool { 558 fn can_cast(kind: SyntaxKind) -> bool { kind == COLON }
694 match kind {
695 COLON => true,
696 _ => false,
697 }
698 }
699 fn cast(syntax: SyntaxToken) -> Option<Self> { 559 fn cast(syntax: SyntaxToken) -> Option<Self> {
700 if Self::can_cast(syntax.kind()) { 560 if Self::can_cast(syntax.kind()) {
701 Some(Self { syntax }) 561 Some(Self { syntax })
@@ -715,12 +575,7 @@ impl std::fmt::Display for Coloncolon {
715 } 575 }
716} 576}
717impl AstToken for Coloncolon { 577impl AstToken for Coloncolon {
718 fn can_cast(kind: SyntaxKind) -> bool { 578 fn can_cast(kind: SyntaxKind) -> bool { kind == COLONCOLON }
719 match kind {
720 COLONCOLON => true,
721 _ => false,
722 }
723 }
724 fn cast(syntax: SyntaxToken) -> Option<Self> { 579 fn cast(syntax: SyntaxToken) -> Option<Self> {
725 if Self::can_cast(syntax.kind()) { 580 if Self::can_cast(syntax.kind()) {
726 Some(Self { syntax }) 581 Some(Self { syntax })
@@ -740,12 +595,7 @@ impl std::fmt::Display for Eq {
740 } 595 }
741} 596}
742impl AstToken for Eq { 597impl AstToken for Eq {
743 fn can_cast(kind: SyntaxKind) -> bool { 598 fn can_cast(kind: SyntaxKind) -> bool { kind == EQ }
744 match kind {
745 EQ => true,
746 _ => false,
747 }
748 }
749 fn cast(syntax: SyntaxToken) -> Option<Self> { 599 fn cast(syntax: SyntaxToken) -> Option<Self> {
750 if Self::can_cast(syntax.kind()) { 600 if Self::can_cast(syntax.kind()) {
751 Some(Self { syntax }) 601 Some(Self { syntax })
@@ -765,12 +615,7 @@ impl std::fmt::Display for Eqeq {
765 } 615 }
766} 616}
767impl AstToken for Eqeq { 617impl AstToken for Eqeq {
768 fn can_cast(kind: SyntaxKind) -> bool { 618 fn can_cast(kind: SyntaxKind) -> bool { kind == EQEQ }
769 match kind {
770 EQEQ => true,
771 _ => false,
772 }
773 }
774 fn cast(syntax: SyntaxToken) -> Option<Self> { 619 fn cast(syntax: SyntaxToken) -> Option<Self> {
775 if Self::can_cast(syntax.kind()) { 620 if Self::can_cast(syntax.kind()) {
776 Some(Self { syntax }) 621 Some(Self { syntax })
@@ -790,12 +635,7 @@ impl std::fmt::Display for FatArrow {
790 } 635 }
791} 636}
792impl AstToken for FatArrow { 637impl AstToken for FatArrow {
793 fn can_cast(kind: SyntaxKind) -> bool { 638 fn can_cast(kind: SyntaxKind) -> bool { kind == FAT_ARROW }
794 match kind {
795 FAT_ARROW => true,
796 _ => false,
797 }
798 }
799 fn cast(syntax: SyntaxToken) -> Option<Self> { 639 fn cast(syntax: SyntaxToken) -> Option<Self> {
800 if Self::can_cast(syntax.kind()) { 640 if Self::can_cast(syntax.kind()) {
801 Some(Self { syntax }) 641 Some(Self { syntax })
@@ -815,12 +655,7 @@ impl std::fmt::Display for Excl {
815 } 655 }
816} 656}
817impl AstToken for Excl { 657impl AstToken for Excl {
818 fn can_cast(kind: SyntaxKind) -> bool { 658 fn can_cast(kind: SyntaxKind) -> bool { kind == EXCL }
819 match kind {
820 EXCL => true,
821 _ => false,
822 }
823 }
824 fn cast(syntax: SyntaxToken) -> Option<Self> { 659 fn cast(syntax: SyntaxToken) -> Option<Self> {
825 if Self::can_cast(syntax.kind()) { 660 if Self::can_cast(syntax.kind()) {
826 Some(Self { syntax }) 661 Some(Self { syntax })
@@ -840,12 +675,7 @@ impl std::fmt::Display for Neq {
840 } 675 }
841} 676}
842impl AstToken for Neq { 677impl AstToken for Neq {
843 fn can_cast(kind: SyntaxKind) -> bool { 678 fn can_cast(kind: SyntaxKind) -> bool { kind == NEQ }
844 match kind {
845 NEQ => true,
846 _ => false,
847 }
848 }
849 fn cast(syntax: SyntaxToken) -> Option<Self> { 679 fn cast(syntax: SyntaxToken) -> Option<Self> {
850 if Self::can_cast(syntax.kind()) { 680 if Self::can_cast(syntax.kind()) {
851 Some(Self { syntax }) 681 Some(Self { syntax })
@@ -865,12 +695,7 @@ impl std::fmt::Display for Minus {
865 } 695 }
866} 696}
867impl AstToken for Minus { 697impl AstToken for Minus {
868 fn can_cast(kind: SyntaxKind) -> bool { 698 fn can_cast(kind: SyntaxKind) -> bool { kind == MINUS }
869 match kind {
870 MINUS => true,
871 _ => false,
872 }
873 }
874 fn cast(syntax: SyntaxToken) -> Option<Self> { 699 fn cast(syntax: SyntaxToken) -> Option<Self> {
875 if Self::can_cast(syntax.kind()) { 700 if Self::can_cast(syntax.kind()) {
876 Some(Self { syntax }) 701 Some(Self { syntax })
@@ -890,12 +715,7 @@ impl std::fmt::Display for ThinArrow {
890 } 715 }
891} 716}
892impl AstToken for ThinArrow { 717impl AstToken for ThinArrow {
893 fn can_cast(kind: SyntaxKind) -> bool { 718 fn can_cast(kind: SyntaxKind) -> bool { kind == THIN_ARROW }
894 match kind {
895 THIN_ARROW => true,
896 _ => false,
897 }
898 }
899 fn cast(syntax: SyntaxToken) -> Option<Self> { 719 fn cast(syntax: SyntaxToken) -> Option<Self> {
900 if Self::can_cast(syntax.kind()) { 720 if Self::can_cast(syntax.kind()) {
901 Some(Self { syntax }) 721 Some(Self { syntax })
@@ -915,12 +735,7 @@ impl std::fmt::Display for Lteq {
915 } 735 }
916} 736}
917impl AstToken for Lteq { 737impl AstToken for Lteq {
918 fn can_cast(kind: SyntaxKind) -> bool { 738 fn can_cast(kind: SyntaxKind) -> bool { kind == LTEQ }
919 match kind {
920 LTEQ => true,
921 _ => false,
922 }
923 }
924 fn cast(syntax: SyntaxToken) -> Option<Self> { 739 fn cast(syntax: SyntaxToken) -> Option<Self> {
925 if Self::can_cast(syntax.kind()) { 740 if Self::can_cast(syntax.kind()) {
926 Some(Self { syntax }) 741 Some(Self { syntax })
@@ -940,12 +755,7 @@ impl std::fmt::Display for Gteq {
940 } 755 }
941} 756}
942impl AstToken for Gteq { 757impl AstToken for Gteq {
943 fn can_cast(kind: SyntaxKind) -> bool { 758 fn can_cast(kind: SyntaxKind) -> bool { kind == GTEQ }
944 match kind {
945 GTEQ => true,
946 _ => false,
947 }
948 }
949 fn cast(syntax: SyntaxToken) -> Option<Self> { 759 fn cast(syntax: SyntaxToken) -> Option<Self> {
950 if Self::can_cast(syntax.kind()) { 760 if Self::can_cast(syntax.kind()) {
951 Some(Self { syntax }) 761 Some(Self { syntax })
@@ -965,12 +775,7 @@ impl std::fmt::Display for Pluseq {
965 } 775 }
966} 776}
967impl AstToken for Pluseq { 777impl AstToken for Pluseq {
968 fn can_cast(kind: SyntaxKind) -> bool { 778 fn can_cast(kind: SyntaxKind) -> bool { kind == PLUSEQ }
969 match kind {
970 PLUSEQ => true,
971 _ => false,
972 }
973 }
974 fn cast(syntax: SyntaxToken) -> Option<Self> { 779 fn cast(syntax: SyntaxToken) -> Option<Self> {
975 if Self::can_cast(syntax.kind()) { 780 if Self::can_cast(syntax.kind()) {
976 Some(Self { syntax }) 781 Some(Self { syntax })
@@ -990,12 +795,7 @@ impl std::fmt::Display for Minuseq {
990 } 795 }
991} 796}
992impl AstToken for Minuseq { 797impl AstToken for Minuseq {
993 fn can_cast(kind: SyntaxKind) -> bool { 798 fn can_cast(kind: SyntaxKind) -> bool { kind == MINUSEQ }
994 match kind {
995 MINUSEQ => true,
996 _ => false,
997 }
998 }
999 fn cast(syntax: SyntaxToken) -> Option<Self> { 799 fn cast(syntax: SyntaxToken) -> Option<Self> {
1000 if Self::can_cast(syntax.kind()) { 800 if Self::can_cast(syntax.kind()) {
1001 Some(Self { syntax }) 801 Some(Self { syntax })
@@ -1015,12 +815,7 @@ impl std::fmt::Display for Pipeeq {
1015 } 815 }
1016} 816}
1017impl AstToken for Pipeeq { 817impl AstToken for Pipeeq {
1018 fn can_cast(kind: SyntaxKind) -> bool { 818 fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEEQ }
1019 match kind {
1020 PIPEEQ => true,
1021 _ => false,
1022 }
1023 }
1024 fn cast(syntax: SyntaxToken) -> Option<Self> { 819 fn cast(syntax: SyntaxToken) -> Option<Self> {
1025 if Self::can_cast(syntax.kind()) { 820 if Self::can_cast(syntax.kind()) {
1026 Some(Self { syntax }) 821 Some(Self { syntax })
@@ -1040,12 +835,7 @@ impl std::fmt::Display for Ampeq {
1040 } 835 }
1041} 836}
1042impl AstToken for Ampeq { 837impl AstToken for Ampeq {
1043 fn can_cast(kind: SyntaxKind) -> bool { 838 fn can_cast(kind: SyntaxKind) -> bool { kind == AMPEQ }
1044 match kind {
1045 AMPEQ => true,
1046 _ => false,
1047 }
1048 }
1049 fn cast(syntax: SyntaxToken) -> Option<Self> { 839 fn cast(syntax: SyntaxToken) -> Option<Self> {
1050 if Self::can_cast(syntax.kind()) { 840 if Self::can_cast(syntax.kind()) {
1051 Some(Self { syntax }) 841 Some(Self { syntax })
@@ -1065,12 +855,7 @@ impl std::fmt::Display for Careteq {
1065 } 855 }
1066} 856}
1067impl AstToken for Careteq { 857impl AstToken for Careteq {
1068 fn can_cast(kind: SyntaxKind) -> bool { 858 fn can_cast(kind: SyntaxKind) -> bool { kind == CARETEQ }
1069 match kind {
1070 CARETEQ => true,
1071 _ => false,
1072 }
1073 }
1074 fn cast(syntax: SyntaxToken) -> Option<Self> { 859 fn cast(syntax: SyntaxToken) -> Option<Self> {
1075 if Self::can_cast(syntax.kind()) { 860 if Self::can_cast(syntax.kind()) {
1076 Some(Self { syntax }) 861 Some(Self { syntax })
@@ -1090,12 +875,7 @@ impl std::fmt::Display for Slasheq {
1090 } 875 }
1091} 876}
1092impl AstToken for Slasheq { 877impl AstToken for Slasheq {
1093 fn can_cast(kind: SyntaxKind) -> bool { 878 fn can_cast(kind: SyntaxKind) -> bool { kind == SLASHEQ }
1094 match kind {
1095 SLASHEQ => true,
1096 _ => false,
1097 }
1098 }
1099 fn cast(syntax: SyntaxToken) -> Option<Self> { 879 fn cast(syntax: SyntaxToken) -> Option<Self> {
1100 if Self::can_cast(syntax.kind()) { 880 if Self::can_cast(syntax.kind()) {
1101 Some(Self { syntax }) 881 Some(Self { syntax })
@@ -1115,12 +895,7 @@ impl std::fmt::Display for Stareq {
1115 } 895 }
1116} 896}
1117impl AstToken for Stareq { 897impl AstToken for Stareq {
1118 fn can_cast(kind: SyntaxKind) -> bool { 898 fn can_cast(kind: SyntaxKind) -> bool { kind == STAREQ }
1119 match kind {
1120 STAREQ => true,
1121 _ => false,
1122 }
1123 }
1124 fn cast(syntax: SyntaxToken) -> Option<Self> { 899 fn cast(syntax: SyntaxToken) -> Option<Self> {
1125 if Self::can_cast(syntax.kind()) { 900 if Self::can_cast(syntax.kind()) {
1126 Some(Self { syntax }) 901 Some(Self { syntax })
@@ -1140,12 +915,7 @@ impl std::fmt::Display for Percenteq {
1140 } 915 }
1141} 916}
1142impl AstToken for Percenteq { 917impl AstToken for Percenteq {
1143 fn can_cast(kind: SyntaxKind) -> bool { 918 fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENTEQ }
1144 match kind {
1145 PERCENTEQ => true,
1146 _ => false,
1147 }
1148 }
1149 fn cast(syntax: SyntaxToken) -> Option<Self> { 919 fn cast(syntax: SyntaxToken) -> Option<Self> {
1150 if Self::can_cast(syntax.kind()) { 920 if Self::can_cast(syntax.kind()) {
1151 Some(Self { syntax }) 921 Some(Self { syntax })
@@ -1165,12 +935,7 @@ impl std::fmt::Display for Ampamp {
1165 } 935 }
1166} 936}
1167impl AstToken for Ampamp { 937impl AstToken for Ampamp {
1168 fn can_cast(kind: SyntaxKind) -> bool { 938 fn can_cast(kind: SyntaxKind) -> bool { kind == AMPAMP }
1169 match kind {
1170 AMPAMP => true,
1171 _ => false,
1172 }
1173 }
1174 fn cast(syntax: SyntaxToken) -> Option<Self> { 939 fn cast(syntax: SyntaxToken) -> Option<Self> {
1175 if Self::can_cast(syntax.kind()) { 940 if Self::can_cast(syntax.kind()) {
1176 Some(Self { syntax }) 941 Some(Self { syntax })
@@ -1190,12 +955,7 @@ impl std::fmt::Display for Pipepipe {
1190 } 955 }
1191} 956}
1192impl AstToken for Pipepipe { 957impl AstToken for Pipepipe {
1193 fn can_cast(kind: SyntaxKind) -> bool { 958 fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEPIPE }
1194 match kind {
1195 PIPEPIPE => true,
1196 _ => false,
1197 }
1198 }
1199 fn cast(syntax: SyntaxToken) -> Option<Self> { 959 fn cast(syntax: SyntaxToken) -> Option<Self> {
1200 if Self::can_cast(syntax.kind()) { 960 if Self::can_cast(syntax.kind()) {
1201 Some(Self { syntax }) 961 Some(Self { syntax })
@@ -1215,12 +975,7 @@ impl std::fmt::Display for Shl {
1215 } 975 }
1216} 976}
1217impl AstToken for Shl { 977impl AstToken for Shl {
1218 fn can_cast(kind: SyntaxKind) -> bool { 978 fn can_cast(kind: SyntaxKind) -> bool { kind == SHL }
1219 match kind {
1220 SHL => true,
1221 _ => false,
1222 }
1223 }
1224 fn cast(syntax: SyntaxToken) -> Option<Self> { 979 fn cast(syntax: SyntaxToken) -> Option<Self> {
1225 if Self::can_cast(syntax.kind()) { 980 if Self::can_cast(syntax.kind()) {
1226 Some(Self { syntax }) 981 Some(Self { syntax })
@@ -1240,12 +995,7 @@ impl std::fmt::Display for Shr {
1240 } 995 }
1241} 996}
1242impl AstToken for Shr { 997impl AstToken for Shr {
1243 fn can_cast(kind: SyntaxKind) -> bool { 998 fn can_cast(kind: SyntaxKind) -> bool { kind == SHR }
1244 match kind {
1245 SHR => true,
1246 _ => false,
1247 }
1248 }
1249 fn cast(syntax: SyntaxToken) -> Option<Self> { 999 fn cast(syntax: SyntaxToken) -> Option<Self> {
1250 if Self::can_cast(syntax.kind()) { 1000 if Self::can_cast(syntax.kind()) {
1251 Some(Self { syntax }) 1001 Some(Self { syntax })
@@ -1265,12 +1015,7 @@ impl std::fmt::Display for Shleq {
1265 } 1015 }
1266} 1016}
1267impl AstToken for Shleq { 1017impl AstToken for Shleq {
1268 fn can_cast(kind: SyntaxKind) -> bool { 1018 fn can_cast(kind: SyntaxKind) -> bool { kind == SHLEQ }
1269 match kind {
1270 SHLEQ => true,
1271 _ => false,
1272 }
1273 }
1274 fn cast(syntax: SyntaxToken) -> Option<Self> { 1019 fn cast(syntax: SyntaxToken) -> Option<Self> {
1275 if Self::can_cast(syntax.kind()) { 1020 if Self::can_cast(syntax.kind()) {
1276 Some(Self { syntax }) 1021 Some(Self { syntax })
@@ -1290,12 +1035,7 @@ impl std::fmt::Display for Shreq {
1290 } 1035 }
1291} 1036}
1292impl AstToken for Shreq { 1037impl AstToken for Shreq {
1293 fn can_cast(kind: SyntaxKind) -> bool { 1038 fn can_cast(kind: SyntaxKind) -> bool { kind == SHREQ }
1294 match kind {
1295 SHREQ => true,
1296 _ => false,
1297 }
1298 }
1299 fn cast(syntax: SyntaxToken) -> Option<Self> { 1039 fn cast(syntax: SyntaxToken) -> Option<Self> {
1300 if Self::can_cast(syntax.kind()) { 1040 if Self::can_cast(syntax.kind()) {
1301 Some(Self { syntax }) 1041 Some(Self { syntax })
@@ -1315,12 +1055,7 @@ impl std::fmt::Display for AsKw {
1315 } 1055 }
1316} 1056}
1317impl AstToken for AsKw { 1057impl AstToken for AsKw {
1318 fn can_cast(kind: SyntaxKind) -> bool { 1058 fn can_cast(kind: SyntaxKind) -> bool { kind == AS_KW }
1319 match kind {
1320 AS_KW => true,
1321 _ => false,
1322 }
1323 }
1324 fn cast(syntax: SyntaxToken) -> Option<Self> { 1059 fn cast(syntax: SyntaxToken) -> Option<Self> {
1325 if Self::can_cast(syntax.kind()) { 1060 if Self::can_cast(syntax.kind()) {
1326 Some(Self { syntax }) 1061 Some(Self { syntax })
@@ -1340,12 +1075,7 @@ impl std::fmt::Display for AsyncKw {
1340 } 1075 }
1341} 1076}
1342impl AstToken for AsyncKw { 1077impl AstToken for AsyncKw {
1343 fn can_cast(kind: SyntaxKind) -> bool { 1078 fn can_cast(kind: SyntaxKind) -> bool { kind == ASYNC_KW }
1344 match kind {
1345 ASYNC_KW => true,
1346 _ => false,
1347 }
1348 }
1349 fn cast(syntax: SyntaxToken) -> Option<Self> { 1079 fn cast(syntax: SyntaxToken) -> Option<Self> {
1350 if Self::can_cast(syntax.kind()) { 1080 if Self::can_cast(syntax.kind()) {
1351 Some(Self { syntax }) 1081 Some(Self { syntax })
@@ -1365,12 +1095,7 @@ impl std::fmt::Display for AwaitKw {
1365 } 1095 }
1366} 1096}
1367impl AstToken for AwaitKw { 1097impl AstToken for AwaitKw {
1368 fn can_cast(kind: SyntaxKind) -> bool { 1098 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_KW }
1369 match kind {
1370 AWAIT_KW => true,
1371 _ => false,
1372 }
1373 }
1374 fn cast(syntax: SyntaxToken) -> Option<Self> { 1099 fn cast(syntax: SyntaxToken) -> Option<Self> {
1375 if Self::can_cast(syntax.kind()) { 1100 if Self::can_cast(syntax.kind()) {
1376 Some(Self { syntax }) 1101 Some(Self { syntax })
@@ -1390,12 +1115,7 @@ impl std::fmt::Display for BoxKw {
1390 } 1115 }
1391} 1116}
1392impl AstToken for BoxKw { 1117impl AstToken for BoxKw {
1393 fn can_cast(kind: SyntaxKind) -> bool { 1118 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_KW }
1394 match kind {
1395 BOX_KW => true,
1396 _ => false,
1397 }
1398 }
1399 fn cast(syntax: SyntaxToken) -> Option<Self> { 1119 fn cast(syntax: SyntaxToken) -> Option<Self> {
1400 if Self::can_cast(syntax.kind()) { 1120 if Self::can_cast(syntax.kind()) {
1401 Some(Self { syntax }) 1121 Some(Self { syntax })
@@ -1415,12 +1135,7 @@ impl std::fmt::Display for BreakKw {
1415 } 1135 }
1416} 1136}
1417impl AstToken for BreakKw { 1137impl AstToken for BreakKw {
1418 fn can_cast(kind: SyntaxKind) -> bool { 1138 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_KW }
1419 match kind {
1420 BREAK_KW => true,
1421 _ => false,
1422 }
1423 }
1424 fn cast(syntax: SyntaxToken) -> Option<Self> { 1139 fn cast(syntax: SyntaxToken) -> Option<Self> {
1425 if Self::can_cast(syntax.kind()) { 1140 if Self::can_cast(syntax.kind()) {
1426 Some(Self { syntax }) 1141 Some(Self { syntax })
@@ -1440,12 +1155,7 @@ impl std::fmt::Display for ConstKw {
1440 } 1155 }
1441} 1156}
1442impl AstToken for ConstKw { 1157impl AstToken for ConstKw {
1443 fn can_cast(kind: SyntaxKind) -> bool { 1158 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_KW }
1444 match kind {
1445 CONST_KW => true,
1446 _ => false,
1447 }
1448 }
1449 fn cast(syntax: SyntaxToken) -> Option<Self> { 1159 fn cast(syntax: SyntaxToken) -> Option<Self> {
1450 if Self::can_cast(syntax.kind()) { 1160 if Self::can_cast(syntax.kind()) {
1451 Some(Self { syntax }) 1161 Some(Self { syntax })
@@ -1465,12 +1175,7 @@ impl std::fmt::Display for ContinueKw {
1465 } 1175 }
1466} 1176}
1467impl AstToken for ContinueKw { 1177impl AstToken for ContinueKw {
1468 fn can_cast(kind: SyntaxKind) -> bool { 1178 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_KW }
1469 match kind {
1470 CONTINUE_KW => true,
1471 _ => false,
1472 }
1473 }
1474 fn cast(syntax: SyntaxToken) -> Option<Self> { 1179 fn cast(syntax: SyntaxToken) -> Option<Self> {
1475 if Self::can_cast(syntax.kind()) { 1180 if Self::can_cast(syntax.kind()) {
1476 Some(Self { syntax }) 1181 Some(Self { syntax })
@@ -1490,12 +1195,7 @@ impl std::fmt::Display for CrateKw {
1490 } 1195 }
1491} 1196}
1492impl AstToken for CrateKw { 1197impl AstToken for CrateKw {
1493 fn can_cast(kind: SyntaxKind) -> bool { 1198 fn can_cast(kind: SyntaxKind) -> bool { kind == CRATE_KW }
1494 match kind {
1495 CRATE_KW => true,
1496 _ => false,
1497 }
1498 }
1499 fn cast(syntax: SyntaxToken) -> Option<Self> { 1199 fn cast(syntax: SyntaxToken) -> Option<Self> {
1500 if Self::can_cast(syntax.kind()) { 1200 if Self::can_cast(syntax.kind()) {
1501 Some(Self { syntax }) 1201 Some(Self { syntax })
@@ -1515,12 +1215,7 @@ impl std::fmt::Display for DynKw {
1515 } 1215 }
1516} 1216}
1517impl AstToken for DynKw { 1217impl AstToken for DynKw {
1518 fn can_cast(kind: SyntaxKind) -> bool { 1218 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_KW }
1519 match kind {
1520 DYN_KW => true,
1521 _ => false,
1522 }
1523 }
1524 fn cast(syntax: SyntaxToken) -> Option<Self> { 1219 fn cast(syntax: SyntaxToken) -> Option<Self> {
1525 if Self::can_cast(syntax.kind()) { 1220 if Self::can_cast(syntax.kind()) {
1526 Some(Self { syntax }) 1221 Some(Self { syntax })
@@ -1540,12 +1235,7 @@ impl std::fmt::Display for ElseKw {
1540 } 1235 }
1541} 1236}
1542impl AstToken for ElseKw { 1237impl AstToken for ElseKw {
1543 fn can_cast(kind: SyntaxKind) -> bool { 1238 fn can_cast(kind: SyntaxKind) -> bool { kind == ELSE_KW }
1544 match kind {
1545 ELSE_KW => true,
1546 _ => false,
1547 }
1548 }
1549 fn cast(syntax: SyntaxToken) -> Option<Self> { 1239 fn cast(syntax: SyntaxToken) -> Option<Self> {
1550 if Self::can_cast(syntax.kind()) { 1240 if Self::can_cast(syntax.kind()) {
1551 Some(Self { syntax }) 1241 Some(Self { syntax })
@@ -1565,12 +1255,7 @@ impl std::fmt::Display for EnumKw {
1565 } 1255 }
1566} 1256}
1567impl AstToken for EnumKw { 1257impl AstToken for EnumKw {
1568 fn can_cast(kind: SyntaxKind) -> bool { 1258 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_KW }
1569 match kind {
1570 ENUM_KW => true,
1571 _ => false,
1572 }
1573 }
1574 fn cast(syntax: SyntaxToken) -> Option<Self> { 1259 fn cast(syntax: SyntaxToken) -> Option<Self> {
1575 if Self::can_cast(syntax.kind()) { 1260 if Self::can_cast(syntax.kind()) {
1576 Some(Self { syntax }) 1261 Some(Self { syntax })
@@ -1590,12 +1275,7 @@ impl std::fmt::Display for ExternKw {
1590 } 1275 }
1591} 1276}
1592impl AstToken for ExternKw { 1277impl AstToken for ExternKw {
1593 fn can_cast(kind: SyntaxKind) -> bool { 1278 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_KW }
1594 match kind {
1595 EXTERN_KW => true,
1596 _ => false,
1597 }
1598 }
1599 fn cast(syntax: SyntaxToken) -> Option<Self> { 1279 fn cast(syntax: SyntaxToken) -> Option<Self> {
1600 if Self::can_cast(syntax.kind()) { 1280 if Self::can_cast(syntax.kind()) {
1601 Some(Self { syntax }) 1281 Some(Self { syntax })
@@ -1615,12 +1295,7 @@ impl std::fmt::Display for FalseKw {
1615 } 1295 }
1616} 1296}
1617impl AstToken for FalseKw { 1297impl AstToken for FalseKw {
1618 fn can_cast(kind: SyntaxKind) -> bool { 1298 fn can_cast(kind: SyntaxKind) -> bool { kind == FALSE_KW }
1619 match kind {
1620 FALSE_KW => true,
1621 _ => false,
1622 }
1623 }
1624 fn cast(syntax: SyntaxToken) -> Option<Self> { 1299 fn cast(syntax: SyntaxToken) -> Option<Self> {
1625 if Self::can_cast(syntax.kind()) { 1300 if Self::can_cast(syntax.kind()) {
1626 Some(Self { syntax }) 1301 Some(Self { syntax })
@@ -1640,12 +1315,7 @@ impl std::fmt::Display for FnKw {
1640 } 1315 }
1641} 1316}
1642impl AstToken for FnKw { 1317impl AstToken for FnKw {
1643 fn can_cast(kind: SyntaxKind) -> bool { 1318 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_KW }
1644 match kind {
1645 FN_KW => true,
1646 _ => false,
1647 }
1648 }
1649 fn cast(syntax: SyntaxToken) -> Option<Self> { 1319 fn cast(syntax: SyntaxToken) -> Option<Self> {
1650 if Self::can_cast(syntax.kind()) { 1320 if Self::can_cast(syntax.kind()) {
1651 Some(Self { syntax }) 1321 Some(Self { syntax })
@@ -1665,12 +1335,7 @@ impl std::fmt::Display for ForKw {
1665 } 1335 }
1666} 1336}
1667impl AstToken for ForKw { 1337impl AstToken for ForKw {
1668 fn can_cast(kind: SyntaxKind) -> bool { 1338 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_KW }
1669 match kind {
1670 FOR_KW => true,
1671 _ => false,
1672 }
1673 }
1674 fn cast(syntax: SyntaxToken) -> Option<Self> { 1339 fn cast(syntax: SyntaxToken) -> Option<Self> {
1675 if Self::can_cast(syntax.kind()) { 1340 if Self::can_cast(syntax.kind()) {
1676 Some(Self { syntax }) 1341 Some(Self { syntax })
@@ -1690,12 +1355,7 @@ impl std::fmt::Display for IfKw {
1690 } 1355 }
1691} 1356}
1692impl AstToken for IfKw { 1357impl AstToken for IfKw {
1693 fn can_cast(kind: SyntaxKind) -> bool { 1358 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_KW }
1694 match kind {
1695 IF_KW => true,
1696 _ => false,
1697 }
1698 }
1699 fn cast(syntax: SyntaxToken) -> Option<Self> { 1359 fn cast(syntax: SyntaxToken) -> Option<Self> {
1700 if Self::can_cast(syntax.kind()) { 1360 if Self::can_cast(syntax.kind()) {
1701 Some(Self { syntax }) 1361 Some(Self { syntax })
@@ -1715,12 +1375,7 @@ impl std::fmt::Display for ImplKw {
1715 } 1375 }
1716} 1376}
1717impl AstToken for ImplKw { 1377impl AstToken for ImplKw {
1718 fn can_cast(kind: SyntaxKind) -> bool { 1378 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_KW }
1719 match kind {
1720 IMPL_KW => true,
1721 _ => false,
1722 }
1723 }
1724 fn cast(syntax: SyntaxToken) -> Option<Self> { 1379 fn cast(syntax: SyntaxToken) -> Option<Self> {
1725 if Self::can_cast(syntax.kind()) { 1380 if Self::can_cast(syntax.kind()) {
1726 Some(Self { syntax }) 1381 Some(Self { syntax })
@@ -1740,12 +1395,7 @@ impl std::fmt::Display for InKw {
1740 } 1395 }
1741} 1396}
1742impl AstToken for InKw { 1397impl AstToken for InKw {
1743 fn can_cast(kind: SyntaxKind) -> bool { 1398 fn can_cast(kind: SyntaxKind) -> bool { kind == IN_KW }
1744 match kind {
1745 IN_KW => true,
1746 _ => false,
1747 }
1748 }
1749 fn cast(syntax: SyntaxToken) -> Option<Self> { 1399 fn cast(syntax: SyntaxToken) -> Option<Self> {
1750 if Self::can_cast(syntax.kind()) { 1400 if Self::can_cast(syntax.kind()) {
1751 Some(Self { syntax }) 1401 Some(Self { syntax })
@@ -1765,12 +1415,7 @@ impl std::fmt::Display for LetKw {
1765 } 1415 }
1766} 1416}
1767impl AstToken for LetKw { 1417impl AstToken for LetKw {
1768 fn can_cast(kind: SyntaxKind) -> bool { 1418 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_KW }
1769 match kind {
1770 LET_KW => true,
1771 _ => false,
1772 }
1773 }
1774 fn cast(syntax: SyntaxToken) -> Option<Self> { 1419 fn cast(syntax: SyntaxToken) -> Option<Self> {
1775 if Self::can_cast(syntax.kind()) { 1420 if Self::can_cast(syntax.kind()) {
1776 Some(Self { syntax }) 1421 Some(Self { syntax })
@@ -1790,12 +1435,7 @@ impl std::fmt::Display for LoopKw {
1790 } 1435 }
1791} 1436}
1792impl AstToken for LoopKw { 1437impl AstToken for LoopKw {
1793 fn can_cast(kind: SyntaxKind) -> bool { 1438 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_KW }
1794 match kind {
1795 LOOP_KW => true,
1796 _ => false,
1797 }
1798 }
1799 fn cast(syntax: SyntaxToken) -> Option<Self> { 1439 fn cast(syntax: SyntaxToken) -> Option<Self> {
1800 if Self::can_cast(syntax.kind()) { 1440 if Self::can_cast(syntax.kind()) {
1801 Some(Self { syntax }) 1441 Some(Self { syntax })
@@ -1815,12 +1455,7 @@ impl std::fmt::Display for MacroKw {
1815 } 1455 }
1816} 1456}
1817impl AstToken for MacroKw { 1457impl AstToken for MacroKw {
1818 fn can_cast(kind: SyntaxKind) -> bool { 1458 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_KW }
1819 match kind {
1820 MACRO_KW => true,
1821 _ => false,
1822 }
1823 }
1824 fn cast(syntax: SyntaxToken) -> Option<Self> { 1459 fn cast(syntax: SyntaxToken) -> Option<Self> {
1825 if Self::can_cast(syntax.kind()) { 1460 if Self::can_cast(syntax.kind()) {
1826 Some(Self { syntax }) 1461 Some(Self { syntax })
@@ -1840,12 +1475,7 @@ impl std::fmt::Display for MatchKw {
1840 } 1475 }
1841} 1476}
1842impl AstToken for MatchKw { 1477impl AstToken for MatchKw {
1843 fn can_cast(kind: SyntaxKind) -> bool { 1478 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_KW }
1844 match kind {
1845 MATCH_KW => true,
1846 _ => false,
1847 }
1848 }
1849 fn cast(syntax: SyntaxToken) -> Option<Self> { 1479 fn cast(syntax: SyntaxToken) -> Option<Self> {
1850 if Self::can_cast(syntax.kind()) { 1480 if Self::can_cast(syntax.kind()) {
1851 Some(Self { syntax }) 1481 Some(Self { syntax })
@@ -1865,12 +1495,7 @@ impl std::fmt::Display for ModKw {
1865 } 1495 }
1866} 1496}
1867impl AstToken for ModKw { 1497impl AstToken for ModKw {
1868 fn can_cast(kind: SyntaxKind) -> bool { 1498 fn can_cast(kind: SyntaxKind) -> bool { kind == MOD_KW }
1869 match kind {
1870 MOD_KW => true,
1871 _ => false,
1872 }
1873 }
1874 fn cast(syntax: SyntaxToken) -> Option<Self> { 1499 fn cast(syntax: SyntaxToken) -> Option<Self> {
1875 if Self::can_cast(syntax.kind()) { 1500 if Self::can_cast(syntax.kind()) {
1876 Some(Self { syntax }) 1501 Some(Self { syntax })
@@ -1890,12 +1515,7 @@ impl std::fmt::Display for MoveKw {
1890 } 1515 }
1891} 1516}
1892impl AstToken for MoveKw { 1517impl AstToken for MoveKw {
1893 fn can_cast(kind: SyntaxKind) -> bool { 1518 fn can_cast(kind: SyntaxKind) -> bool { kind == MOVE_KW }
1894 match kind {
1895 MOVE_KW => true,
1896 _ => false,
1897 }
1898 }
1899 fn cast(syntax: SyntaxToken) -> Option<Self> { 1519 fn cast(syntax: SyntaxToken) -> Option<Self> {
1900 if Self::can_cast(syntax.kind()) { 1520 if Self::can_cast(syntax.kind()) {
1901 Some(Self { syntax }) 1521 Some(Self { syntax })
@@ -1915,12 +1535,7 @@ impl std::fmt::Display for MutKw {
1915 } 1535 }
1916} 1536}
1917impl AstToken for MutKw { 1537impl AstToken for MutKw {
1918 fn can_cast(kind: SyntaxKind) -> bool { 1538 fn can_cast(kind: SyntaxKind) -> bool { kind == MUT_KW }
1919 match kind {
1920 MUT_KW => true,
1921 _ => false,
1922 }
1923 }
1924 fn cast(syntax: SyntaxToken) -> Option<Self> { 1539 fn cast(syntax: SyntaxToken) -> Option<Self> {
1925 if Self::can_cast(syntax.kind()) { 1540 if Self::can_cast(syntax.kind()) {
1926 Some(Self { syntax }) 1541 Some(Self { syntax })
@@ -1940,12 +1555,7 @@ impl std::fmt::Display for PubKw {
1940 } 1555 }
1941} 1556}
1942impl AstToken for PubKw { 1557impl AstToken for PubKw {
1943 fn can_cast(kind: SyntaxKind) -> bool { 1558 fn can_cast(kind: SyntaxKind) -> bool { kind == PUB_KW }
1944 match kind {
1945 PUB_KW => true,
1946 _ => false,
1947 }
1948 }
1949 fn cast(syntax: SyntaxToken) -> Option<Self> { 1559 fn cast(syntax: SyntaxToken) -> Option<Self> {
1950 if Self::can_cast(syntax.kind()) { 1560 if Self::can_cast(syntax.kind()) {
1951 Some(Self { syntax }) 1561 Some(Self { syntax })
@@ -1965,12 +1575,7 @@ impl std::fmt::Display for RefKw {
1965 } 1575 }
1966} 1576}
1967impl AstToken for RefKw { 1577impl AstToken for RefKw {
1968 fn can_cast(kind: SyntaxKind) -> bool { 1578 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_KW }
1969 match kind {
1970 REF_KW => true,
1971 _ => false,
1972 }
1973 }
1974 fn cast(syntax: SyntaxToken) -> Option<Self> { 1579 fn cast(syntax: SyntaxToken) -> Option<Self> {
1975 if Self::can_cast(syntax.kind()) { 1580 if Self::can_cast(syntax.kind()) {
1976 Some(Self { syntax }) 1581 Some(Self { syntax })
@@ -1990,12 +1595,7 @@ impl std::fmt::Display for ReturnKw {
1990 } 1595 }
1991} 1596}
1992impl AstToken for ReturnKw { 1597impl AstToken for ReturnKw {
1993 fn can_cast(kind: SyntaxKind) -> bool { 1598 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_KW }
1994 match kind {
1995 RETURN_KW => true,
1996 _ => false,
1997 }
1998 }
1999 fn cast(syntax: SyntaxToken) -> Option<Self> { 1599 fn cast(syntax: SyntaxToken) -> Option<Self> {
2000 if Self::can_cast(syntax.kind()) { 1600 if Self::can_cast(syntax.kind()) {
2001 Some(Self { syntax }) 1601 Some(Self { syntax })
@@ -2015,12 +1615,7 @@ impl std::fmt::Display for SelfKw {
2015 } 1615 }
2016} 1616}
2017impl AstToken for SelfKw { 1617impl AstToken for SelfKw {
2018 fn can_cast(kind: SyntaxKind) -> bool { 1618 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_KW }
2019 match kind {
2020 SELF_KW => true,
2021 _ => false,
2022 }
2023 }
2024 fn cast(syntax: SyntaxToken) -> Option<Self> { 1619 fn cast(syntax: SyntaxToken) -> Option<Self> {
2025 if Self::can_cast(syntax.kind()) { 1620 if Self::can_cast(syntax.kind()) {
2026 Some(Self { syntax }) 1621 Some(Self { syntax })
@@ -2040,12 +1635,7 @@ impl std::fmt::Display for StaticKw {
2040 } 1635 }
2041} 1636}
2042impl AstToken for StaticKw { 1637impl AstToken for StaticKw {
2043 fn can_cast(kind: SyntaxKind) -> bool { 1638 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_KW }
2044 match kind {
2045 STATIC_KW => true,
2046 _ => false,
2047 }
2048 }
2049 fn cast(syntax: SyntaxToken) -> Option<Self> { 1639 fn cast(syntax: SyntaxToken) -> Option<Self> {
2050 if Self::can_cast(syntax.kind()) { 1640 if Self::can_cast(syntax.kind()) {
2051 Some(Self { syntax }) 1641 Some(Self { syntax })
@@ -2065,12 +1655,7 @@ impl std::fmt::Display for StructKw {
2065 } 1655 }
2066} 1656}
2067impl AstToken for StructKw { 1657impl AstToken for StructKw {
2068 fn can_cast(kind: SyntaxKind) -> bool { 1658 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_KW }
2069 match kind {
2070 STRUCT_KW => true,
2071 _ => false,
2072 }
2073 }
2074 fn cast(syntax: SyntaxToken) -> Option<Self> { 1659 fn cast(syntax: SyntaxToken) -> Option<Self> {
2075 if Self::can_cast(syntax.kind()) { 1660 if Self::can_cast(syntax.kind()) {
2076 Some(Self { syntax }) 1661 Some(Self { syntax })
@@ -2090,12 +1675,7 @@ impl std::fmt::Display for SuperKw {
2090 } 1675 }
2091} 1676}
2092impl AstToken for SuperKw { 1677impl AstToken for SuperKw {
2093 fn can_cast(kind: SyntaxKind) -> bool { 1678 fn can_cast(kind: SyntaxKind) -> bool { kind == SUPER_KW }
2094 match kind {
2095 SUPER_KW => true,
2096 _ => false,
2097 }
2098 }
2099 fn cast(syntax: SyntaxToken) -> Option<Self> { 1679 fn cast(syntax: SyntaxToken) -> Option<Self> {
2100 if Self::can_cast(syntax.kind()) { 1680 if Self::can_cast(syntax.kind()) {
2101 Some(Self { syntax }) 1681 Some(Self { syntax })
@@ -2115,12 +1695,7 @@ impl std::fmt::Display for TraitKw {
2115 } 1695 }
2116} 1696}
2117impl AstToken for TraitKw { 1697impl AstToken for TraitKw {
2118 fn can_cast(kind: SyntaxKind) -> bool { 1698 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_KW }
2119 match kind {
2120 TRAIT_KW => true,
2121 _ => false,
2122 }
2123 }
2124 fn cast(syntax: SyntaxToken) -> Option<Self> { 1699 fn cast(syntax: SyntaxToken) -> Option<Self> {
2125 if Self::can_cast(syntax.kind()) { 1700 if Self::can_cast(syntax.kind()) {
2126 Some(Self { syntax }) 1701 Some(Self { syntax })
@@ -2140,12 +1715,7 @@ impl std::fmt::Display for TrueKw {
2140 } 1715 }
2141} 1716}
2142impl AstToken for TrueKw { 1717impl AstToken for TrueKw {
2143 fn can_cast(kind: SyntaxKind) -> bool { 1718 fn can_cast(kind: SyntaxKind) -> bool { kind == TRUE_KW }
2144 match kind {
2145 TRUE_KW => true,
2146 _ => false,
2147 }
2148 }
2149 fn cast(syntax: SyntaxToken) -> Option<Self> { 1719 fn cast(syntax: SyntaxToken) -> Option<Self> {
2150 if Self::can_cast(syntax.kind()) { 1720 if Self::can_cast(syntax.kind()) {
2151 Some(Self { syntax }) 1721 Some(Self { syntax })
@@ -2165,12 +1735,7 @@ impl std::fmt::Display for TryKw {
2165 } 1735 }
2166} 1736}
2167impl AstToken for TryKw { 1737impl AstToken for TryKw {
2168 fn can_cast(kind: SyntaxKind) -> bool { 1738 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_KW }
2169 match kind {
2170 TRY_KW => true,
2171 _ => false,
2172 }
2173 }
2174 fn cast(syntax: SyntaxToken) -> Option<Self> { 1739 fn cast(syntax: SyntaxToken) -> Option<Self> {
2175 if Self::can_cast(syntax.kind()) { 1740 if Self::can_cast(syntax.kind()) {
2176 Some(Self { syntax }) 1741 Some(Self { syntax })
@@ -2190,12 +1755,7 @@ impl std::fmt::Display for TypeKw {
2190 } 1755 }
2191} 1756}
2192impl AstToken for TypeKw { 1757impl AstToken for TypeKw {
2193 fn can_cast(kind: SyntaxKind) -> bool { 1758 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_KW }
2194 match kind {
2195 TYPE_KW => true,
2196 _ => false,
2197 }
2198 }
2199 fn cast(syntax: SyntaxToken) -> Option<Self> { 1759 fn cast(syntax: SyntaxToken) -> Option<Self> {
2200 if Self::can_cast(syntax.kind()) { 1760 if Self::can_cast(syntax.kind()) {
2201 Some(Self { syntax }) 1761 Some(Self { syntax })
@@ -2215,12 +1775,7 @@ impl std::fmt::Display for UnsafeKw {
2215 } 1775 }
2216} 1776}
2217impl AstToken for UnsafeKw { 1777impl AstToken for UnsafeKw {
2218 fn can_cast(kind: SyntaxKind) -> bool { 1778 fn can_cast(kind: SyntaxKind) -> bool { kind == UNSAFE_KW }
2219 match kind {
2220 UNSAFE_KW => true,
2221 _ => false,
2222 }
2223 }
2224 fn cast(syntax: SyntaxToken) -> Option<Self> { 1779 fn cast(syntax: SyntaxToken) -> Option<Self> {
2225 if Self::can_cast(syntax.kind()) { 1780 if Self::can_cast(syntax.kind()) {
2226 Some(Self { syntax }) 1781 Some(Self { syntax })
@@ -2240,12 +1795,7 @@ impl std::fmt::Display for UseKw {
2240 } 1795 }
2241} 1796}
2242impl AstToken for UseKw { 1797impl AstToken for UseKw {
2243 fn can_cast(kind: SyntaxKind) -> bool { 1798 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_KW }
2244 match kind {
2245 USE_KW => true,
2246 _ => false,
2247 }
2248 }
2249 fn cast(syntax: SyntaxToken) -> Option<Self> { 1799 fn cast(syntax: SyntaxToken) -> Option<Self> {
2250 if Self::can_cast(syntax.kind()) { 1800 if Self::can_cast(syntax.kind()) {
2251 Some(Self { syntax }) 1801 Some(Self { syntax })
@@ -2265,12 +1815,7 @@ impl std::fmt::Display for WhereKw {
2265 } 1815 }
2266} 1816}
2267impl AstToken for WhereKw { 1817impl AstToken for WhereKw {
2268 fn can_cast(kind: SyntaxKind) -> bool { 1818 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_KW }
2269 match kind {
2270 WHERE_KW => true,
2271 _ => false,
2272 }
2273 }
2274 fn cast(syntax: SyntaxToken) -> Option<Self> { 1819 fn cast(syntax: SyntaxToken) -> Option<Self> {
2275 if Self::can_cast(syntax.kind()) { 1820 if Self::can_cast(syntax.kind()) {
2276 Some(Self { syntax }) 1821 Some(Self { syntax })
@@ -2290,12 +1835,7 @@ impl std::fmt::Display for WhileKw {
2290 } 1835 }
2291} 1836}
2292impl AstToken for WhileKw { 1837impl AstToken for WhileKw {
2293 fn can_cast(kind: SyntaxKind) -> bool { 1838 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_KW }
2294 match kind {
2295 WHILE_KW => true,
2296 _ => false,
2297 }
2298 }
2299 fn cast(syntax: SyntaxToken) -> Option<Self> { 1839 fn cast(syntax: SyntaxToken) -> Option<Self> {
2300 if Self::can_cast(syntax.kind()) { 1840 if Self::can_cast(syntax.kind()) {
2301 Some(Self { syntax }) 1841 Some(Self { syntax })
@@ -2315,12 +1855,7 @@ impl std::fmt::Display for AutoKw {
2315 } 1855 }
2316} 1856}
2317impl AstToken for AutoKw { 1857impl AstToken for AutoKw {
2318 fn can_cast(kind: SyntaxKind) -> bool { 1858 fn can_cast(kind: SyntaxKind) -> bool { kind == AUTO_KW }
2319 match kind {
2320 AUTO_KW => true,
2321 _ => false,
2322 }
2323 }
2324 fn cast(syntax: SyntaxToken) -> Option<Self> { 1859 fn cast(syntax: SyntaxToken) -> Option<Self> {
2325 if Self::can_cast(syntax.kind()) { 1860 if Self::can_cast(syntax.kind()) {
2326 Some(Self { syntax }) 1861 Some(Self { syntax })
@@ -2340,12 +1875,7 @@ impl std::fmt::Display for DefaultKw {
2340 } 1875 }
2341} 1876}
2342impl AstToken for DefaultKw { 1877impl AstToken for DefaultKw {
2343 fn can_cast(kind: SyntaxKind) -> bool { 1878 fn can_cast(kind: SyntaxKind) -> bool { kind == DEFAULT_KW }
2344 match kind {
2345 DEFAULT_KW => true,
2346 _ => false,
2347 }
2348 }
2349 fn cast(syntax: SyntaxToken) -> Option<Self> { 1879 fn cast(syntax: SyntaxToken) -> Option<Self> {
2350 if Self::can_cast(syntax.kind()) { 1880 if Self::can_cast(syntax.kind()) {
2351 Some(Self { syntax }) 1881 Some(Self { syntax })
@@ -2365,12 +1895,7 @@ impl std::fmt::Display for ExistentialKw {
2365 } 1895 }
2366} 1896}
2367impl AstToken for ExistentialKw { 1897impl AstToken for ExistentialKw {
2368 fn can_cast(kind: SyntaxKind) -> bool { 1898 fn can_cast(kind: SyntaxKind) -> bool { kind == EXISTENTIAL_KW }
2369 match kind {
2370 EXISTENTIAL_KW => true,
2371 _ => false,
2372 }
2373 }
2374 fn cast(syntax: SyntaxToken) -> Option<Self> { 1899 fn cast(syntax: SyntaxToken) -> Option<Self> {
2375 if Self::can_cast(syntax.kind()) { 1900 if Self::can_cast(syntax.kind()) {
2376 Some(Self { syntax }) 1901 Some(Self { syntax })
@@ -2390,12 +1915,7 @@ impl std::fmt::Display for UnionKw {
2390 } 1915 }
2391} 1916}
2392impl AstToken for UnionKw { 1917impl AstToken for UnionKw {
2393 fn can_cast(kind: SyntaxKind) -> bool { 1918 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_KW }
2394 match kind {
2395 UNION_KW => true,
2396 _ => false,
2397 }
2398 }
2399 fn cast(syntax: SyntaxToken) -> Option<Self> { 1919 fn cast(syntax: SyntaxToken) -> Option<Self> {
2400 if Self::can_cast(syntax.kind()) { 1920 if Self::can_cast(syntax.kind()) {
2401 Some(Self { syntax }) 1921 Some(Self { syntax })
@@ -2415,12 +1935,7 @@ impl std::fmt::Display for RawKw {
2415 } 1935 }
2416} 1936}
2417impl AstToken for RawKw { 1937impl AstToken for RawKw {
2418 fn can_cast(kind: SyntaxKind) -> bool { 1938 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_KW }
2419 match kind {
2420 RAW_KW => true,
2421 _ => false,
2422 }
2423 }
2424 fn cast(syntax: SyntaxToken) -> Option<Self> { 1939 fn cast(syntax: SyntaxToken) -> Option<Self> {
2425 if Self::can_cast(syntax.kind()) { 1940 if Self::can_cast(syntax.kind()) {
2426 Some(Self { syntax }) 1941 Some(Self { syntax })
@@ -2440,12 +1955,7 @@ impl std::fmt::Display for IntNumber {
2440 } 1955 }
2441} 1956}
2442impl AstToken for IntNumber { 1957impl AstToken for IntNumber {
2443 fn can_cast(kind: SyntaxKind) -> bool { 1958 fn can_cast(kind: SyntaxKind) -> bool { kind == INT_NUMBER }
2444 match kind {
2445 INT_NUMBER => true,
2446 _ => false,
2447 }
2448 }
2449 fn cast(syntax: SyntaxToken) -> Option<Self> { 1959 fn cast(syntax: SyntaxToken) -> Option<Self> {
2450 if Self::can_cast(syntax.kind()) { 1960 if Self::can_cast(syntax.kind()) {
2451 Some(Self { syntax }) 1961 Some(Self { syntax })
@@ -2465,12 +1975,7 @@ impl std::fmt::Display for FloatNumber {
2465 } 1975 }
2466} 1976}
2467impl AstToken for FloatNumber { 1977impl AstToken for FloatNumber {
2468 fn can_cast(kind: SyntaxKind) -> bool { 1978 fn can_cast(kind: SyntaxKind) -> bool { kind == FLOAT_NUMBER }
2469 match kind {
2470 FLOAT_NUMBER => true,
2471 _ => false,
2472 }
2473 }
2474 fn cast(syntax: SyntaxToken) -> Option<Self> { 1979 fn cast(syntax: SyntaxToken) -> Option<Self> {
2475 if Self::can_cast(syntax.kind()) { 1980 if Self::can_cast(syntax.kind()) {
2476 Some(Self { syntax }) 1981 Some(Self { syntax })
@@ -2490,12 +1995,7 @@ impl std::fmt::Display for Char {
2490 } 1995 }
2491} 1996}
2492impl AstToken for Char { 1997impl AstToken for Char {
2493 fn can_cast(kind: SyntaxKind) -> bool { 1998 fn can_cast(kind: SyntaxKind) -> bool { kind == CHAR }
2494 match kind {
2495 CHAR => true,
2496 _ => false,
2497 }
2498 }
2499 fn cast(syntax: SyntaxToken) -> Option<Self> { 1999 fn cast(syntax: SyntaxToken) -> Option<Self> {
2500 if Self::can_cast(syntax.kind()) { 2000 if Self::can_cast(syntax.kind()) {
2501 Some(Self { syntax }) 2001 Some(Self { syntax })
@@ -2515,12 +2015,7 @@ impl std::fmt::Display for Byte {
2515 } 2015 }
2516} 2016}
2517impl AstToken for Byte { 2017impl AstToken for Byte {
2518 fn can_cast(kind: SyntaxKind) -> bool { 2018 fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE }
2519 match kind {
2520 BYTE => true,
2521 _ => false,
2522 }
2523 }
2524 fn cast(syntax: SyntaxToken) -> Option<Self> { 2019 fn cast(syntax: SyntaxToken) -> Option<Self> {
2525 if Self::can_cast(syntax.kind()) { 2020 if Self::can_cast(syntax.kind()) {
2526 Some(Self { syntax }) 2021 Some(Self { syntax })
@@ -2540,12 +2035,7 @@ impl std::fmt::Display for String {
2540 } 2035 }
2541} 2036}
2542impl AstToken for String { 2037impl AstToken for String {
2543 fn can_cast(kind: SyntaxKind) -> bool { 2038 fn can_cast(kind: SyntaxKind) -> bool { kind == STRING }
2544 match kind {
2545 STRING => true,
2546 _ => false,
2547 }
2548 }
2549 fn cast(syntax: SyntaxToken) -> Option<Self> { 2039 fn cast(syntax: SyntaxToken) -> Option<Self> {
2550 if Self::can_cast(syntax.kind()) { 2040 if Self::can_cast(syntax.kind()) {
2551 Some(Self { syntax }) 2041 Some(Self { syntax })
@@ -2565,12 +2055,7 @@ impl std::fmt::Display for RawString {
2565 } 2055 }
2566} 2056}
2567impl AstToken for RawString { 2057impl AstToken for RawString {
2568 fn can_cast(kind: SyntaxKind) -> bool { 2058 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING }
2569 match kind {
2570 RAW_STRING => true,
2571 _ => false,
2572 }
2573 }
2574 fn cast(syntax: SyntaxToken) -> Option<Self> { 2059 fn cast(syntax: SyntaxToken) -> Option<Self> {
2575 if Self::can_cast(syntax.kind()) { 2060 if Self::can_cast(syntax.kind()) {
2576 Some(Self { syntax }) 2061 Some(Self { syntax })
@@ -2590,12 +2075,7 @@ impl std::fmt::Display for ByteString {
2590 } 2075 }
2591} 2076}
2592impl AstToken for ByteString { 2077impl AstToken for ByteString {
2593 fn can_cast(kind: SyntaxKind) -> bool { 2078 fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE_STRING }
2594 match kind {
2595 BYTE_STRING => true,
2596 _ => false,
2597 }
2598 }
2599 fn cast(syntax: SyntaxToken) -> Option<Self> { 2079 fn cast(syntax: SyntaxToken) -> Option<Self> {
2600 if Self::can_cast(syntax.kind()) { 2080 if Self::can_cast(syntax.kind()) {
2601 Some(Self { syntax }) 2081 Some(Self { syntax })
@@ -2615,12 +2095,7 @@ impl std::fmt::Display for RawByteString {
2615 } 2095 }
2616} 2096}
2617impl AstToken for RawByteString { 2097impl AstToken for RawByteString {
2618 fn can_cast(kind: SyntaxKind) -> bool { 2098 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_BYTE_STRING }
2619 match kind {
2620 RAW_BYTE_STRING => true,
2621 _ => false,
2622 }
2623 }
2624 fn cast(syntax: SyntaxToken) -> Option<Self> { 2099 fn cast(syntax: SyntaxToken) -> Option<Self> {
2625 if Self::can_cast(syntax.kind()) { 2100 if Self::can_cast(syntax.kind()) {
2626 Some(Self { syntax }) 2101 Some(Self { syntax })
@@ -2640,12 +2115,7 @@ impl std::fmt::Display for Error {
2640 } 2115 }
2641} 2116}
2642impl AstToken for Error { 2117impl AstToken for Error {
2643 fn can_cast(kind: SyntaxKind) -> bool { 2118 fn can_cast(kind: SyntaxKind) -> bool { kind == ERROR }
2644 match kind {
2645 ERROR => true,
2646 _ => false,
2647 }
2648 }
2649 fn cast(syntax: SyntaxToken) -> Option<Self> { 2119 fn cast(syntax: SyntaxToken) -> Option<Self> {
2650 if Self::can_cast(syntax.kind()) { 2120 if Self::can_cast(syntax.kind()) {
2651 Some(Self { syntax }) 2121 Some(Self { syntax })
@@ -2665,12 +2135,7 @@ impl std::fmt::Display for Ident {
2665 } 2135 }
2666} 2136}
2667impl AstToken for Ident { 2137impl AstToken for Ident {
2668 fn can_cast(kind: SyntaxKind) -> bool { 2138 fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT }
2669 match kind {
2670 IDENT => true,
2671 _ => false,
2672 }
2673 }
2674 fn cast(syntax: SyntaxToken) -> Option<Self> { 2139 fn cast(syntax: SyntaxToken) -> Option<Self> {
2675 if Self::can_cast(syntax.kind()) { 2140 if Self::can_cast(syntax.kind()) {
2676 Some(Self { syntax }) 2141 Some(Self { syntax })
@@ -2690,12 +2155,7 @@ impl std::fmt::Display for Whitespace {
2690 } 2155 }
2691} 2156}
2692impl AstToken for Whitespace { 2157impl AstToken for Whitespace {
2693 fn can_cast(kind: SyntaxKind) -> bool { 2158 fn can_cast(kind: SyntaxKind) -> bool { kind == WHITESPACE }
2694 match kind {
2695 WHITESPACE => true,
2696 _ => false,
2697 }
2698 }
2699 fn cast(syntax: SyntaxToken) -> Option<Self> { 2159 fn cast(syntax: SyntaxToken) -> Option<Self> {
2700 if Self::can_cast(syntax.kind()) { 2160 if Self::can_cast(syntax.kind()) {
2701 Some(Self { syntax }) 2161 Some(Self { syntax })
@@ -2715,12 +2175,7 @@ impl std::fmt::Display for Lifetime {
2715 } 2175 }
2716} 2176}
2717impl AstToken for Lifetime { 2177impl AstToken for Lifetime {
2718 fn can_cast(kind: SyntaxKind) -> bool { 2178 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME }
2719 match kind {
2720 LIFETIME => true,
2721 _ => false,
2722 }
2723 }
2724 fn cast(syntax: SyntaxToken) -> Option<Self> { 2179 fn cast(syntax: SyntaxToken) -> Option<Self> {
2725 if Self::can_cast(syntax.kind()) { 2180 if Self::can_cast(syntax.kind()) {
2726 Some(Self { syntax }) 2181 Some(Self { syntax })
@@ -2740,12 +2195,7 @@ impl std::fmt::Display for Comment {
2740 } 2195 }
2741} 2196}
2742impl AstToken for Comment { 2197impl AstToken for Comment {
2743 fn can_cast(kind: SyntaxKind) -> bool { 2198 fn can_cast(kind: SyntaxKind) -> bool { kind == COMMENT }
2744 match kind {
2745 COMMENT => true,
2746 _ => false,
2747 }
2748 }
2749 fn cast(syntax: SyntaxToken) -> Option<Self> { 2199 fn cast(syntax: SyntaxToken) -> Option<Self> {
2750 if Self::can_cast(syntax.kind()) { 2200 if Self::can_cast(syntax.kind()) {
2751 Some(Self { syntax }) 2201 Some(Self { syntax })
@@ -2765,12 +2215,7 @@ impl std::fmt::Display for Shebang {
2765 } 2215 }
2766} 2216}
2767impl AstToken for Shebang { 2217impl AstToken for Shebang {
2768 fn can_cast(kind: SyntaxKind) -> bool { 2218 fn can_cast(kind: SyntaxKind) -> bool { kind == SHEBANG }
2769 match kind {
2770 SHEBANG => true,
2771 _ => false,
2772 }
2773 }
2774 fn cast(syntax: SyntaxToken) -> Option<Self> { 2219 fn cast(syntax: SyntaxToken) -> Option<Self> {
2775 if Self::can_cast(syntax.kind()) { 2220 if Self::can_cast(syntax.kind()) {
2776 Some(Self { syntax }) 2221 Some(Self { syntax })
@@ -2790,12 +2235,7 @@ impl std::fmt::Display for LDollar {
2790 } 2235 }
2791} 2236}
2792impl AstToken for LDollar { 2237impl AstToken for LDollar {
2793 fn can_cast(kind: SyntaxKind) -> bool { 2238 fn can_cast(kind: SyntaxKind) -> bool { kind == L_DOLLAR }
2794 match kind {
2795 L_DOLLAR => true,
2796 _ => false,
2797 }
2798 }
2799 fn cast(syntax: SyntaxToken) -> Option<Self> { 2239 fn cast(syntax: SyntaxToken) -> Option<Self> {
2800 if Self::can_cast(syntax.kind()) { 2240 if Self::can_cast(syntax.kind()) {
2801 Some(Self { syntax }) 2241 Some(Self { syntax })
@@ -2815,12 +2255,7 @@ impl std::fmt::Display for RDollar {
2815 } 2255 }
2816} 2256}
2817impl AstToken for RDollar { 2257impl AstToken for RDollar {
2818 fn can_cast(kind: SyntaxKind) -> bool { 2258 fn can_cast(kind: SyntaxKind) -> bool { kind == R_DOLLAR }
2819 match kind {
2820 R_DOLLAR => true,
2821 _ => false,
2822 }
2823 }
2824 fn cast(syntax: SyntaxToken) -> Option<Self> { 2259 fn cast(syntax: SyntaxToken) -> Option<Self> {
2825 if Self::can_cast(syntax.kind()) { 2260 if Self::can_cast(syntax.kind()) {
2826 Some(Self { syntax }) 2261 Some(Self { syntax })
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index 9801a3dba..f9a50c5b9 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -75,12 +75,7 @@ fn generate_tokens(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> {
75 } 75 }
76 76
77 impl AstToken for #name { 77 impl AstToken for #name {
78 fn can_cast(kind: SyntaxKind) -> bool { 78 fn can_cast(kind: SyntaxKind) -> bool { kind == #kind }
79 match kind {
80 #kind => true,
81 _ => false,
82 }
83 }
84 fn cast(syntax: SyntaxToken) -> Option<Self> { 79 fn cast(syntax: SyntaxToken) -> Option<Self> {
85 if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None } 80 if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
86 } 81 }
@@ -243,10 +238,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> {
243 238
244 impl AstNode for #name { 239 impl AstNode for #name {
245 fn can_cast(kind: SyntaxKind) -> bool { 240 fn can_cast(kind: SyntaxKind) -> bool {
246 match kind { 241 kind == #kind
247 #kind => true,
248 _ => false,
249 }
250 } 242 }
251 fn cast(syntax: SyntaxNode) -> Option<Self> { 243 fn cast(syntax: SyntaxNode) -> Option<Self> {
252 if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None } 244 if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }