diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated/nodes.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 875 |
1 files changed, 125 insertions, 750 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 | } |
18 | impl AstNode for SourceFile { | 18 | impl 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 | } |
49 | impl AstNode for FnDef { | 44 | impl 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 | } |
91 | impl AstNode for RetType { | 81 | impl 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 | } |
120 | impl AstNode for StructDef { | 105 | impl 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 | } |
155 | impl AstNode for UnionDef { | 135 | impl 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 | } |
191 | impl AstNode for RecordFieldDefList { | 166 | impl 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 | } |
221 | impl AstNode for RecordFieldDef { | 191 | impl 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 | } |
252 | impl AstNode for TupleFieldDefList { | 217 | impl 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 | } |
282 | impl AstNode for TupleFieldDef { | 242 | impl 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 | } |
312 | impl AstNode for EnumDef { | 267 | impl 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 | } |
346 | impl AstNode for EnumVariantList { | 296 | impl 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 | } |
376 | impl AstNode for EnumVariant { | 321 | impl 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 | } |
410 | impl AstNode for TraitDef { | 350 | impl 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 | } |
447 | impl AstNode for Module { | 382 | impl 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 | } |
481 | impl AstNode for ItemList { | 411 | impl 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 | } |
513 | impl AstNode for ConstDef { | 438 | impl 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 | } |
551 | impl AstNode for StaticDef { | 471 | impl 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 | } |
589 | impl AstNode for TypeAliasDef { | 504 | impl 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 | } |
627 | impl AstNode for ImplDef { | 537 | impl 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 | } |
663 | impl AstNode for ParenType { | 568 | impl 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 | } |
693 | impl AstNode for TupleType { | 593 | impl 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 | } |
723 | impl AstNode for NeverType { | 618 | impl 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 | } |
751 | impl AstNode for PathType { | 641 | impl 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 | } |
779 | impl AstNode for PointerType { | 664 | impl 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 | } |
809 | impl AstNode for ArrayType { | 689 | impl 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 | } |
841 | impl AstNode for SliceType { | 716 | impl 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 | } |
871 | impl AstNode for ReferenceType { | 741 | impl 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 | } |
902 | impl AstNode for PlaceholderType { | 767 | impl 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 | } |
930 | impl AstNode for FnPointerType { | 790 | impl 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 | } |
962 | impl AstNode for ForType { | 817 | impl 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 | } |
992 | impl AstNode for ImplTraitType { | 842 | impl 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 | } |
1021 | impl AstNode for DynTraitType { | 866 | impl 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 | } |
1050 | impl AstNode for TupleExpr { | 890 | impl 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 | } |
1081 | impl AstNode for ArrayExpr { | 916 | impl 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 | } |
1113 | impl AstNode for ParenExpr { | 943 | impl 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 | } |
1144 | impl AstNode for PathExpr { | 969 | impl 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 | } |
1172 | impl AstNode for LambdaExpr { | 992 | impl 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 | } |
1206 | impl AstNode for IfExpr { | 1021 | impl 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 | } |
1236 | impl AstNode for LoopExpr { | 1046 | impl 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 | } |
1266 | impl AstNode for TryBlockExpr { | 1071 | impl 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 | } |
1296 | impl AstNode for ForExpr { | 1096 | impl 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 | } |
1329 | impl AstNode for WhileExpr { | 1124 | impl 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 | } |
1360 | impl AstNode for ContinueExpr { | 1150 | impl 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 | } |
1390 | impl AstNode for BreakExpr { | 1175 | impl 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 | } |
1421 | impl AstNode for Label { | 1201 | impl 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 | } |
1449 | impl AstNode for BlockExpr { | 1224 | impl 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 | } |
1480 | impl AstNode for ReturnExpr { | 1250 | impl 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 | } |
1509 | impl AstNode for CallExpr { | 1274 | impl 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 | } |
1538 | impl AstNode for MethodCallExpr { | 1298 | impl 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 | } |
1571 | impl AstNode for IndexExpr { | 1326 | impl 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 | } |
1601 | impl AstNode for FieldExpr { | 1351 | impl 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 | } |
1632 | impl AstNode for AwaitExpr { | 1377 | impl 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 | } |
1663 | impl AstNode for TryExpr { | 1403 | impl 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 | } |
1693 | impl AstNode for CastExpr { | 1428 | impl 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 | } |
1724 | impl AstNode for RefExpr { | 1454 | impl 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 | } |
1756 | impl AstNode for PrefixExpr { | 1481 | impl 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 | } |
1786 | impl AstNode for BoxExpr { | 1506 | impl 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 | } |
1816 | impl AstNode for RangeExpr { | 1531 | impl 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 | } |
1845 | impl AstNode for BinExpr { | 1555 | impl 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 | } |
1874 | impl AstNode for Literal { | 1579 | impl 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 | } |
1902 | impl AstNode for MatchExpr { | 1602 | impl 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 | } |
1933 | impl AstNode for MatchArmList { | 1628 | impl 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 | } |
1964 | impl AstNode for MatchArm { | 1654 | impl 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 | } |
1996 | impl AstNode for MatchGuard { | 1681 | impl 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 | } |
2025 | impl AstNode for RecordLit { | 1705 | impl 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 | } |
2054 | impl AstNode for RecordFieldList { | 1729 | impl 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 | } |
2086 | impl AstNode for RecordField { | 1756 | impl 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 | } |
2117 | impl AstNode for OrPat { | 1782 | impl 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 | } |
2145 | impl AstNode for ParenPat { | 1805 | impl 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 | } |
2175 | impl AstNode for RefPat { | 1830 | impl 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 | } |
2205 | impl AstNode for BoxPat { | 1855 | impl 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 | } |
2234 | impl AstNode for BindPat { | 1879 | impl 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 | } |
2266 | impl AstNode for PlaceholderPat { | 1906 | impl 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 | } |
2294 | impl AstNode for DotDotPat { | 1929 | impl 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 | } |
2322 | impl AstNode for PathPat { | 1952 | impl 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 | } |
2350 | impl AstNode for SlicePat { | 1975 | impl 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 | } |
2380 | impl AstNode for RangePat { | 2000 | impl 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 | } |
2408 | impl AstNode for LiteralPat { | 2023 | impl 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 | } |
2436 | impl AstNode for MacroPat { | 2046 | impl 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 | } |
2464 | impl AstNode for RecordPat { | 2069 | impl 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 | } |
2495 | impl AstNode for RecordFieldPatList { | 2095 | impl 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 | } |
2530 | impl AstNode for RecordFieldPat { | 2125 | impl 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 | } |
2561 | impl AstNode for TupleStructPat { | 2151 | impl 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 | } |
2592 | impl AstNode for TuplePat { | 2177 | impl 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 | } |
2622 | impl AstNode for Visibility { | 2202 | impl 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 | } |
2653 | impl AstNode for Name { | 2228 | impl 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 | } |
2681 | impl AstNode for NameRef { | 2251 | impl 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 | } |
2709 | impl AstNode for MacroCall { | 2274 | impl 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 | } |
2743 | impl AstNode for Attr { | 2303 | impl 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 | } |
2777 | impl AstNode for TokenTree { | 2332 | impl 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 | } |
2803 | impl AstNode for TypeParamList { | 2353 | impl 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 | } |
2836 | impl AstNode for TypeParam { | 2381 | impl 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 | } |
2868 | impl AstNode for ConstParam { | 2408 | impl 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 | } |
2900 | impl AstNode for LifetimeParam { | 2435 | impl 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 | } |
2929 | impl AstNode for TypeBound { | 2459 | impl 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 | } |
2959 | impl AstNode for TypeBoundList { | 2484 | impl 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 | } |
2987 | impl AstNode for WherePred { | 2507 | impl 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 | } |
3017 | impl AstNode for WhereClause { | 2532 | impl 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 | } |
3046 | impl AstNode for Abi { | 2556 | impl 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 | } |
3074 | impl AstNode for ExprStmt { | 2579 | impl 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 | } |
3104 | impl AstNode for LetStmt { | 2604 | impl 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 | } |
3137 | impl AstNode for Condition { | 2632 | impl 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 | } |
3168 | impl AstNode for Block { | 2658 | impl 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 | } |
3201 | impl AstNode for ParamList { | 2686 | impl 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 | } |
3232 | impl AstNode for SelfParam { | 2712 | impl 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 | } |
3264 | impl AstNode for Param { | 2739 | impl 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 | } |
3295 | impl AstNode for UseItem { | 2765 | impl 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 | } |
3326 | impl AstNode for UseTree { | 2791 | impl 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 | } |
3357 | impl AstNode for Alias { | 2817 | impl 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 | } |
3386 | impl AstNode for UseTreeList { | 2841 | impl 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 | } |
3416 | impl AstNode for ExternCrateItem { | 2866 | impl 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 | } |
3449 | impl AstNode for ArgList { | 2894 | impl 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 | } |
3479 | impl AstNode for Path { | 2919 | impl 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 | } |
3508 | impl AstNode for PathSegment { | 2943 | impl 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 | } |
3543 | impl AstNode for TypeArgList { | 2973 | impl 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 | } |
3578 | impl AstNode for TypeArg { | 3003 | impl 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 | } |
3606 | impl AstNode for AssocTypeArg { | 3026 | impl 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 | } |
3637 | impl AstNode for LifetimeArg { | 3052 | impl 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 | } |
3665 | impl AstNode for ConstArg { | 3075 | impl 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 | } |
3695 | impl AstNode for MacroItems { | 3100 | impl 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 | } |
3723 | impl AstNode for MacroStmts { | 3123 | impl 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 | } |
3752 | impl AstNode for ExternItemList { | 3147 | impl 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 | } |
3784 | impl AstNode for ExternBlock { | 3174 | impl 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 | } |
3813 | impl AstNode for MetaItem { | 3198 | impl 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 | } |
3844 | impl AstNode for MacroDef { | 3224 | impl 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 }) |