diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 635 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer.rs | 4 | ||||
-rw-r--r-- | crates/ra_syntax/src/tests.rs | 10 |
4 files changed, 643 insertions, 8 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 4a70c712f..26fafb469 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -30,7 +30,7 @@ pub use self::{ | |||
30 | /// conversion itself has zero runtime cost: ast and syntax nodes have exactly | 30 | /// conversion itself has zero runtime cost: ast and syntax nodes have exactly |
31 | /// the same representation: a pointer to the tree root and a pointer to the | 31 | /// the same representation: a pointer to the tree root and a pointer to the |
32 | /// node itself. | 32 | /// node itself. |
33 | pub trait AstNode { | 33 | pub trait AstNode: std::fmt::Display { |
34 | fn can_cast(kind: SyntaxKind) -> bool | 34 | fn can_cast(kind: SyntaxKind) -> bool |
35 | where | 35 | where |
36 | Self: Sized; | 36 | Self: Sized; |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 150893e39..002f453cd 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -9,6 +9,11 @@ use crate::{ | |||
9 | pub struct SourceFile { | 9 | pub struct SourceFile { |
10 | pub(crate) syntax: SyntaxNode, | 10 | pub(crate) syntax: SyntaxNode, |
11 | } | 11 | } |
12 | impl std::fmt::Display for SourceFile { | ||
13 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
14 | std::fmt::Display::fmt(self.syntax(), f) | ||
15 | } | ||
16 | } | ||
12 | impl AstNode for SourceFile { | 17 | impl AstNode for SourceFile { |
13 | fn can_cast(kind: SyntaxKind) -> bool { | 18 | fn can_cast(kind: SyntaxKind) -> bool { |
14 | match kind { | 19 | match kind { |
@@ -38,6 +43,11 @@ impl SourceFile { | |||
38 | pub struct FnDef { | 43 | pub struct FnDef { |
39 | pub(crate) syntax: SyntaxNode, | 44 | pub(crate) syntax: SyntaxNode, |
40 | } | 45 | } |
46 | impl std::fmt::Display for FnDef { | ||
47 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
48 | std::fmt::Display::fmt(self.syntax(), f) | ||
49 | } | ||
50 | } | ||
41 | impl AstNode for FnDef { | 51 | impl AstNode for FnDef { |
42 | fn can_cast(kind: SyntaxKind) -> bool { | 52 | fn can_cast(kind: SyntaxKind) -> bool { |
43 | match kind { | 53 | match kind { |
@@ -76,6 +86,11 @@ impl FnDef { | |||
76 | pub struct RetType { | 86 | pub struct RetType { |
77 | pub(crate) syntax: SyntaxNode, | 87 | pub(crate) syntax: SyntaxNode, |
78 | } | 88 | } |
89 | impl std::fmt::Display for RetType { | ||
90 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
91 | std::fmt::Display::fmt(self.syntax(), f) | ||
92 | } | ||
93 | } | ||
79 | impl AstNode for RetType { | 94 | impl AstNode for RetType { |
80 | fn can_cast(kind: SyntaxKind) -> bool { | 95 | fn can_cast(kind: SyntaxKind) -> bool { |
81 | match kind { | 96 | match kind { |
@@ -103,6 +118,11 @@ impl RetType { | |||
103 | pub struct StructDef { | 118 | pub struct StructDef { |
104 | pub(crate) syntax: SyntaxNode, | 119 | pub(crate) syntax: SyntaxNode, |
105 | } | 120 | } |
121 | impl std::fmt::Display for StructDef { | ||
122 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
123 | std::fmt::Display::fmt(self.syntax(), f) | ||
124 | } | ||
125 | } | ||
106 | impl AstNode for StructDef { | 126 | impl AstNode for StructDef { |
107 | fn can_cast(kind: SyntaxKind) -> bool { | 127 | fn can_cast(kind: SyntaxKind) -> bool { |
108 | match kind { | 128 | match kind { |
@@ -131,6 +151,11 @@ impl StructDef {} | |||
131 | pub struct UnionDef { | 151 | pub struct UnionDef { |
132 | pub(crate) syntax: SyntaxNode, | 152 | pub(crate) syntax: SyntaxNode, |
133 | } | 153 | } |
154 | impl std::fmt::Display for UnionDef { | ||
155 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
156 | std::fmt::Display::fmt(self.syntax(), f) | ||
157 | } | ||
158 | } | ||
134 | impl AstNode for UnionDef { | 159 | impl AstNode for UnionDef { |
135 | fn can_cast(kind: SyntaxKind) -> bool { | 160 | fn can_cast(kind: SyntaxKind) -> bool { |
136 | match kind { | 161 | match kind { |
@@ -163,6 +188,11 @@ impl UnionDef { | |||
163 | pub struct RecordFieldDefList { | 188 | pub struct RecordFieldDefList { |
164 | pub(crate) syntax: SyntaxNode, | 189 | pub(crate) syntax: SyntaxNode, |
165 | } | 190 | } |
191 | impl std::fmt::Display for RecordFieldDefList { | ||
192 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
193 | std::fmt::Display::fmt(self.syntax(), f) | ||
194 | } | ||
195 | } | ||
166 | impl AstNode for RecordFieldDefList { | 196 | impl AstNode for RecordFieldDefList { |
167 | fn can_cast(kind: SyntaxKind) -> bool { | 197 | fn can_cast(kind: SyntaxKind) -> bool { |
168 | match kind { | 198 | match kind { |
@@ -190,6 +220,11 @@ impl RecordFieldDefList { | |||
190 | pub struct RecordFieldDef { | 220 | pub struct RecordFieldDef { |
191 | pub(crate) syntax: SyntaxNode, | 221 | pub(crate) syntax: SyntaxNode, |
192 | } | 222 | } |
223 | impl std::fmt::Display for RecordFieldDef { | ||
224 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
225 | std::fmt::Display::fmt(self.syntax(), f) | ||
226 | } | ||
227 | } | ||
193 | impl AstNode for RecordFieldDef { | 228 | impl AstNode for RecordFieldDef { |
194 | fn can_cast(kind: SyntaxKind) -> bool { | 229 | fn can_cast(kind: SyntaxKind) -> bool { |
195 | match kind { | 230 | match kind { |
@@ -218,6 +253,11 @@ impl RecordFieldDef {} | |||
218 | pub struct TupleFieldDefList { | 253 | pub struct TupleFieldDefList { |
219 | pub(crate) syntax: SyntaxNode, | 254 | pub(crate) syntax: SyntaxNode, |
220 | } | 255 | } |
256 | impl std::fmt::Display for TupleFieldDefList { | ||
257 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
258 | std::fmt::Display::fmt(self.syntax(), f) | ||
259 | } | ||
260 | } | ||
221 | impl AstNode for TupleFieldDefList { | 261 | impl AstNode for TupleFieldDefList { |
222 | fn can_cast(kind: SyntaxKind) -> bool { | 262 | fn can_cast(kind: SyntaxKind) -> bool { |
223 | match kind { | 263 | match kind { |
@@ -245,6 +285,11 @@ impl TupleFieldDefList { | |||
245 | pub struct TupleFieldDef { | 285 | pub struct TupleFieldDef { |
246 | pub(crate) syntax: SyntaxNode, | 286 | pub(crate) syntax: SyntaxNode, |
247 | } | 287 | } |
288 | impl std::fmt::Display for TupleFieldDef { | ||
289 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
290 | std::fmt::Display::fmt(self.syntax(), f) | ||
291 | } | ||
292 | } | ||
248 | impl AstNode for TupleFieldDef { | 293 | impl AstNode for TupleFieldDef { |
249 | fn can_cast(kind: SyntaxKind) -> bool { | 294 | fn can_cast(kind: SyntaxKind) -> bool { |
250 | match kind { | 295 | match kind { |
@@ -274,6 +319,11 @@ impl TupleFieldDef { | |||
274 | pub struct EnumDef { | 319 | pub struct EnumDef { |
275 | pub(crate) syntax: SyntaxNode, | 320 | pub(crate) syntax: SyntaxNode, |
276 | } | 321 | } |
322 | impl std::fmt::Display for EnumDef { | ||
323 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
324 | std::fmt::Display::fmt(self.syntax(), f) | ||
325 | } | ||
326 | } | ||
277 | impl AstNode for EnumDef { | 327 | impl AstNode for EnumDef { |
278 | fn can_cast(kind: SyntaxKind) -> bool { | 328 | fn can_cast(kind: SyntaxKind) -> bool { |
279 | match kind { | 329 | match kind { |
@@ -306,6 +356,11 @@ impl EnumDef { | |||
306 | pub struct EnumVariantList { | 356 | pub struct EnumVariantList { |
307 | pub(crate) syntax: SyntaxNode, | 357 | pub(crate) syntax: SyntaxNode, |
308 | } | 358 | } |
359 | impl std::fmt::Display for EnumVariantList { | ||
360 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
361 | std::fmt::Display::fmt(self.syntax(), f) | ||
362 | } | ||
363 | } | ||
309 | impl AstNode for EnumVariantList { | 364 | impl AstNode for EnumVariantList { |
310 | fn can_cast(kind: SyntaxKind) -> bool { | 365 | fn can_cast(kind: SyntaxKind) -> bool { |
311 | match kind { | 366 | match kind { |
@@ -333,6 +388,11 @@ impl EnumVariantList { | |||
333 | pub struct EnumVariant { | 388 | pub struct EnumVariant { |
334 | pub(crate) syntax: SyntaxNode, | 389 | pub(crate) syntax: SyntaxNode, |
335 | } | 390 | } |
391 | impl std::fmt::Display for EnumVariant { | ||
392 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
393 | std::fmt::Display::fmt(self.syntax(), f) | ||
394 | } | ||
395 | } | ||
336 | impl AstNode for EnumVariant { | 396 | impl AstNode for EnumVariant { |
337 | fn can_cast(kind: SyntaxKind) -> bool { | 397 | fn can_cast(kind: SyntaxKind) -> bool { |
338 | match kind { | 398 | match kind { |
@@ -363,6 +423,11 @@ impl EnumVariant { | |||
363 | pub struct TraitDef { | 423 | pub struct TraitDef { |
364 | pub(crate) syntax: SyntaxNode, | 424 | pub(crate) syntax: SyntaxNode, |
365 | } | 425 | } |
426 | impl std::fmt::Display for TraitDef { | ||
427 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
428 | std::fmt::Display::fmt(self.syntax(), f) | ||
429 | } | ||
430 | } | ||
366 | impl AstNode for TraitDef { | 431 | impl AstNode for TraitDef { |
367 | fn can_cast(kind: SyntaxKind) -> bool { | 432 | fn can_cast(kind: SyntaxKind) -> bool { |
368 | match kind { | 433 | match kind { |
@@ -396,6 +461,11 @@ impl TraitDef { | |||
396 | pub struct Module { | 461 | pub struct Module { |
397 | pub(crate) syntax: SyntaxNode, | 462 | pub(crate) syntax: SyntaxNode, |
398 | } | 463 | } |
464 | impl std::fmt::Display for Module { | ||
465 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
466 | std::fmt::Display::fmt(self.syntax(), f) | ||
467 | } | ||
468 | } | ||
399 | impl AstNode for Module { | 469 | impl AstNode for Module { |
400 | fn can_cast(kind: SyntaxKind) -> bool { | 470 | fn can_cast(kind: SyntaxKind) -> bool { |
401 | match kind { | 471 | match kind { |
@@ -427,6 +497,11 @@ impl Module { | |||
427 | pub struct ItemList { | 497 | pub struct ItemList { |
428 | pub(crate) syntax: SyntaxNode, | 498 | pub(crate) syntax: SyntaxNode, |
429 | } | 499 | } |
500 | impl std::fmt::Display for ItemList { | ||
501 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
502 | std::fmt::Display::fmt(self.syntax(), f) | ||
503 | } | ||
504 | } | ||
430 | impl AstNode for ItemList { | 505 | impl AstNode for ItemList { |
431 | fn can_cast(kind: SyntaxKind) -> bool { | 506 | fn can_cast(kind: SyntaxKind) -> bool { |
432 | match kind { | 507 | match kind { |
@@ -456,6 +531,11 @@ impl ItemList { | |||
456 | pub struct ConstDef { | 531 | pub struct ConstDef { |
457 | pub(crate) syntax: SyntaxNode, | 532 | pub(crate) syntax: SyntaxNode, |
458 | } | 533 | } |
534 | impl std::fmt::Display for ConstDef { | ||
535 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
536 | std::fmt::Display::fmt(self.syntax(), f) | ||
537 | } | ||
538 | } | ||
459 | impl AstNode for ConstDef { | 539 | impl AstNode for ConstDef { |
460 | fn can_cast(kind: SyntaxKind) -> bool { | 540 | fn can_cast(kind: SyntaxKind) -> bool { |
461 | match kind { | 541 | match kind { |
@@ -489,6 +569,11 @@ impl ConstDef { | |||
489 | pub struct StaticDef { | 569 | pub struct StaticDef { |
490 | pub(crate) syntax: SyntaxNode, | 570 | pub(crate) syntax: SyntaxNode, |
491 | } | 571 | } |
572 | impl std::fmt::Display for StaticDef { | ||
573 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
574 | std::fmt::Display::fmt(self.syntax(), f) | ||
575 | } | ||
576 | } | ||
492 | impl AstNode for StaticDef { | 577 | impl AstNode for StaticDef { |
493 | fn can_cast(kind: SyntaxKind) -> bool { | 578 | fn can_cast(kind: SyntaxKind) -> bool { |
494 | match kind { | 579 | match kind { |
@@ -522,6 +607,11 @@ impl StaticDef { | |||
522 | pub struct TypeAliasDef { | 607 | pub struct TypeAliasDef { |
523 | pub(crate) syntax: SyntaxNode, | 608 | pub(crate) syntax: SyntaxNode, |
524 | } | 609 | } |
610 | impl std::fmt::Display for TypeAliasDef { | ||
611 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
612 | std::fmt::Display::fmt(self.syntax(), f) | ||
613 | } | ||
614 | } | ||
525 | impl AstNode for TypeAliasDef { | 615 | impl AstNode for TypeAliasDef { |
526 | fn can_cast(kind: SyntaxKind) -> bool { | 616 | fn can_cast(kind: SyntaxKind) -> bool { |
527 | match kind { | 617 | match kind { |
@@ -555,6 +645,11 @@ impl TypeAliasDef { | |||
555 | pub struct ImplDef { | 645 | pub struct ImplDef { |
556 | pub(crate) syntax: SyntaxNode, | 646 | pub(crate) syntax: SyntaxNode, |
557 | } | 647 | } |
648 | impl std::fmt::Display for ImplDef { | ||
649 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
650 | std::fmt::Display::fmt(self.syntax(), f) | ||
651 | } | ||
652 | } | ||
558 | impl AstNode for ImplDef { | 653 | impl AstNode for ImplDef { |
559 | fn can_cast(kind: SyntaxKind) -> bool { | 654 | fn can_cast(kind: SyntaxKind) -> bool { |
560 | match kind { | 655 | match kind { |
@@ -584,6 +679,11 @@ impl ImplDef { | |||
584 | pub struct ParenType { | 679 | pub struct ParenType { |
585 | pub(crate) syntax: SyntaxNode, | 680 | pub(crate) syntax: SyntaxNode, |
586 | } | 681 | } |
682 | impl std::fmt::Display for ParenType { | ||
683 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
684 | std::fmt::Display::fmt(self.syntax(), f) | ||
685 | } | ||
686 | } | ||
587 | impl AstNode for ParenType { | 687 | impl AstNode for ParenType { |
588 | fn can_cast(kind: SyntaxKind) -> bool { | 688 | fn can_cast(kind: SyntaxKind) -> bool { |
589 | match kind { | 689 | match kind { |
@@ -611,6 +711,11 @@ impl ParenType { | |||
611 | pub struct TupleType { | 711 | pub struct TupleType { |
612 | pub(crate) syntax: SyntaxNode, | 712 | pub(crate) syntax: SyntaxNode, |
613 | } | 713 | } |
714 | impl std::fmt::Display for TupleType { | ||
715 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
716 | std::fmt::Display::fmt(self.syntax(), f) | ||
717 | } | ||
718 | } | ||
614 | impl AstNode for TupleType { | 719 | impl AstNode for TupleType { |
615 | fn can_cast(kind: SyntaxKind) -> bool { | 720 | fn can_cast(kind: SyntaxKind) -> bool { |
616 | match kind { | 721 | match kind { |
@@ -638,6 +743,11 @@ impl TupleType { | |||
638 | pub struct NeverType { | 743 | pub struct NeverType { |
639 | pub(crate) syntax: SyntaxNode, | 744 | pub(crate) syntax: SyntaxNode, |
640 | } | 745 | } |
746 | impl std::fmt::Display for NeverType { | ||
747 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
748 | std::fmt::Display::fmt(self.syntax(), f) | ||
749 | } | ||
750 | } | ||
641 | impl AstNode for NeverType { | 751 | impl AstNode for NeverType { |
642 | fn can_cast(kind: SyntaxKind) -> bool { | 752 | fn can_cast(kind: SyntaxKind) -> bool { |
643 | match kind { | 753 | match kind { |
@@ -661,6 +771,11 @@ impl NeverType {} | |||
661 | pub struct PathType { | 771 | pub struct PathType { |
662 | pub(crate) syntax: SyntaxNode, | 772 | pub(crate) syntax: SyntaxNode, |
663 | } | 773 | } |
774 | impl std::fmt::Display for PathType { | ||
775 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
776 | std::fmt::Display::fmt(self.syntax(), f) | ||
777 | } | ||
778 | } | ||
664 | impl AstNode for PathType { | 779 | impl AstNode for PathType { |
665 | fn can_cast(kind: SyntaxKind) -> bool { | 780 | fn can_cast(kind: SyntaxKind) -> bool { |
666 | match kind { | 781 | match kind { |
@@ -688,6 +803,11 @@ impl PathType { | |||
688 | pub struct PointerType { | 803 | pub struct PointerType { |
689 | pub(crate) syntax: SyntaxNode, | 804 | pub(crate) syntax: SyntaxNode, |
690 | } | 805 | } |
806 | impl std::fmt::Display for PointerType { | ||
807 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
808 | std::fmt::Display::fmt(self.syntax(), f) | ||
809 | } | ||
810 | } | ||
691 | impl AstNode for PointerType { | 811 | impl AstNode for PointerType { |
692 | fn can_cast(kind: SyntaxKind) -> bool { | 812 | fn can_cast(kind: SyntaxKind) -> bool { |
693 | match kind { | 813 | match kind { |
@@ -715,6 +835,11 @@ impl PointerType { | |||
715 | pub struct ArrayType { | 835 | pub struct ArrayType { |
716 | pub(crate) syntax: SyntaxNode, | 836 | pub(crate) syntax: SyntaxNode, |
717 | } | 837 | } |
838 | impl std::fmt::Display for ArrayType { | ||
839 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
840 | std::fmt::Display::fmt(self.syntax(), f) | ||
841 | } | ||
842 | } | ||
718 | impl AstNode for ArrayType { | 843 | impl AstNode for ArrayType { |
719 | fn can_cast(kind: SyntaxKind) -> bool { | 844 | fn can_cast(kind: SyntaxKind) -> bool { |
720 | match kind { | 845 | match kind { |
@@ -745,6 +870,11 @@ impl ArrayType { | |||
745 | pub struct SliceType { | 870 | pub struct SliceType { |
746 | pub(crate) syntax: SyntaxNode, | 871 | pub(crate) syntax: SyntaxNode, |
747 | } | 872 | } |
873 | impl std::fmt::Display for SliceType { | ||
874 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
875 | std::fmt::Display::fmt(self.syntax(), f) | ||
876 | } | ||
877 | } | ||
748 | impl AstNode for SliceType { | 878 | impl AstNode for SliceType { |
749 | fn can_cast(kind: SyntaxKind) -> bool { | 879 | fn can_cast(kind: SyntaxKind) -> bool { |
750 | match kind { | 880 | match kind { |
@@ -772,6 +902,11 @@ impl SliceType { | |||
772 | pub struct ReferenceType { | 902 | pub struct ReferenceType { |
773 | pub(crate) syntax: SyntaxNode, | 903 | pub(crate) syntax: SyntaxNode, |
774 | } | 904 | } |
905 | impl std::fmt::Display for ReferenceType { | ||
906 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
907 | std::fmt::Display::fmt(self.syntax(), f) | ||
908 | } | ||
909 | } | ||
775 | impl AstNode for ReferenceType { | 910 | impl AstNode for ReferenceType { |
776 | fn can_cast(kind: SyntaxKind) -> bool { | 911 | fn can_cast(kind: SyntaxKind) -> bool { |
777 | match kind { | 912 | match kind { |
@@ -799,6 +934,11 @@ impl ReferenceType { | |||
799 | pub struct PlaceholderType { | 934 | pub struct PlaceholderType { |
800 | pub(crate) syntax: SyntaxNode, | 935 | pub(crate) syntax: SyntaxNode, |
801 | } | 936 | } |
937 | impl std::fmt::Display for PlaceholderType { | ||
938 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
939 | std::fmt::Display::fmt(self.syntax(), f) | ||
940 | } | ||
941 | } | ||
802 | impl AstNode for PlaceholderType { | 942 | impl AstNode for PlaceholderType { |
803 | fn can_cast(kind: SyntaxKind) -> bool { | 943 | fn can_cast(kind: SyntaxKind) -> bool { |
804 | match kind { | 944 | match kind { |
@@ -822,6 +962,11 @@ impl PlaceholderType {} | |||
822 | pub struct FnPointerType { | 962 | pub struct FnPointerType { |
823 | pub(crate) syntax: SyntaxNode, | 963 | pub(crate) syntax: SyntaxNode, |
824 | } | 964 | } |
965 | impl std::fmt::Display for FnPointerType { | ||
966 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
967 | std::fmt::Display::fmt(self.syntax(), f) | ||
968 | } | ||
969 | } | ||
825 | impl AstNode for FnPointerType { | 970 | impl AstNode for FnPointerType { |
826 | fn can_cast(kind: SyntaxKind) -> bool { | 971 | fn can_cast(kind: SyntaxKind) -> bool { |
827 | match kind { | 972 | match kind { |
@@ -852,6 +997,11 @@ impl FnPointerType { | |||
852 | pub struct ForType { | 997 | pub struct ForType { |
853 | pub(crate) syntax: SyntaxNode, | 998 | pub(crate) syntax: SyntaxNode, |
854 | } | 999 | } |
1000 | impl std::fmt::Display for ForType { | ||
1001 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1002 | std::fmt::Display::fmt(self.syntax(), f) | ||
1003 | } | ||
1004 | } | ||
855 | impl AstNode for ForType { | 1005 | impl AstNode for ForType { |
856 | fn can_cast(kind: SyntaxKind) -> bool { | 1006 | fn can_cast(kind: SyntaxKind) -> bool { |
857 | match kind { | 1007 | match kind { |
@@ -879,6 +1029,11 @@ impl ForType { | |||
879 | pub struct ImplTraitType { | 1029 | pub struct ImplTraitType { |
880 | pub(crate) syntax: SyntaxNode, | 1030 | pub(crate) syntax: SyntaxNode, |
881 | } | 1031 | } |
1032 | impl std::fmt::Display for ImplTraitType { | ||
1033 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1034 | std::fmt::Display::fmt(self.syntax(), f) | ||
1035 | } | ||
1036 | } | ||
882 | impl AstNode for ImplTraitType { | 1037 | impl AstNode for ImplTraitType { |
883 | fn can_cast(kind: SyntaxKind) -> bool { | 1038 | fn can_cast(kind: SyntaxKind) -> bool { |
884 | match kind { | 1039 | match kind { |
@@ -903,6 +1058,11 @@ impl ImplTraitType {} | |||
903 | pub struct DynTraitType { | 1058 | pub struct DynTraitType { |
904 | pub(crate) syntax: SyntaxNode, | 1059 | pub(crate) syntax: SyntaxNode, |
905 | } | 1060 | } |
1061 | impl std::fmt::Display for DynTraitType { | ||
1062 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1063 | std::fmt::Display::fmt(self.syntax(), f) | ||
1064 | } | ||
1065 | } | ||
906 | impl AstNode for DynTraitType { | 1066 | impl AstNode for DynTraitType { |
907 | fn can_cast(kind: SyntaxKind) -> bool { | 1067 | fn can_cast(kind: SyntaxKind) -> bool { |
908 | match kind { | 1068 | match kind { |
@@ -927,6 +1087,11 @@ impl DynTraitType {} | |||
927 | pub struct TupleExpr { | 1087 | pub struct TupleExpr { |
928 | pub(crate) syntax: SyntaxNode, | 1088 | pub(crate) syntax: SyntaxNode, |
929 | } | 1089 | } |
1090 | impl std::fmt::Display for TupleExpr { | ||
1091 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1092 | std::fmt::Display::fmt(self.syntax(), f) | ||
1093 | } | ||
1094 | } | ||
930 | impl AstNode for TupleExpr { | 1095 | impl AstNode for TupleExpr { |
931 | fn can_cast(kind: SyntaxKind) -> bool { | 1096 | fn can_cast(kind: SyntaxKind) -> bool { |
932 | match kind { | 1097 | match kind { |
@@ -954,6 +1119,11 @@ impl TupleExpr { | |||
954 | pub struct ArrayExpr { | 1119 | pub struct ArrayExpr { |
955 | pub(crate) syntax: SyntaxNode, | 1120 | pub(crate) syntax: SyntaxNode, |
956 | } | 1121 | } |
1122 | impl std::fmt::Display for ArrayExpr { | ||
1123 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1124 | std::fmt::Display::fmt(self.syntax(), f) | ||
1125 | } | ||
1126 | } | ||
957 | impl AstNode for ArrayExpr { | 1127 | impl AstNode for ArrayExpr { |
958 | fn can_cast(kind: SyntaxKind) -> bool { | 1128 | fn can_cast(kind: SyntaxKind) -> bool { |
959 | match kind { | 1129 | match kind { |
@@ -981,6 +1151,11 @@ impl ArrayExpr { | |||
981 | pub struct ParenExpr { | 1151 | pub struct ParenExpr { |
982 | pub(crate) syntax: SyntaxNode, | 1152 | pub(crate) syntax: SyntaxNode, |
983 | } | 1153 | } |
1154 | impl std::fmt::Display for ParenExpr { | ||
1155 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1156 | std::fmt::Display::fmt(self.syntax(), f) | ||
1157 | } | ||
1158 | } | ||
984 | impl AstNode for ParenExpr { | 1159 | impl AstNode for ParenExpr { |
985 | fn can_cast(kind: SyntaxKind) -> bool { | 1160 | fn can_cast(kind: SyntaxKind) -> bool { |
986 | match kind { | 1161 | match kind { |
@@ -1008,6 +1183,11 @@ impl ParenExpr { | |||
1008 | pub struct PathExpr { | 1183 | pub struct PathExpr { |
1009 | pub(crate) syntax: SyntaxNode, | 1184 | pub(crate) syntax: SyntaxNode, |
1010 | } | 1185 | } |
1186 | impl std::fmt::Display for PathExpr { | ||
1187 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1188 | std::fmt::Display::fmt(self.syntax(), f) | ||
1189 | } | ||
1190 | } | ||
1011 | impl AstNode for PathExpr { | 1191 | impl AstNode for PathExpr { |
1012 | fn can_cast(kind: SyntaxKind) -> bool { | 1192 | fn can_cast(kind: SyntaxKind) -> bool { |
1013 | match kind { | 1193 | match kind { |
@@ -1035,6 +1215,11 @@ impl PathExpr { | |||
1035 | pub struct LambdaExpr { | 1215 | pub struct LambdaExpr { |
1036 | pub(crate) syntax: SyntaxNode, | 1216 | pub(crate) syntax: SyntaxNode, |
1037 | } | 1217 | } |
1218 | impl std::fmt::Display for LambdaExpr { | ||
1219 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1220 | std::fmt::Display::fmt(self.syntax(), f) | ||
1221 | } | ||
1222 | } | ||
1038 | impl AstNode for LambdaExpr { | 1223 | impl AstNode for LambdaExpr { |
1039 | fn can_cast(kind: SyntaxKind) -> bool { | 1224 | fn can_cast(kind: SyntaxKind) -> bool { |
1040 | match kind { | 1225 | match kind { |
@@ -1068,6 +1253,11 @@ impl LambdaExpr { | |||
1068 | pub struct IfExpr { | 1253 | pub struct IfExpr { |
1069 | pub(crate) syntax: SyntaxNode, | 1254 | pub(crate) syntax: SyntaxNode, |
1070 | } | 1255 | } |
1256 | impl std::fmt::Display for IfExpr { | ||
1257 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1258 | std::fmt::Display::fmt(self.syntax(), f) | ||
1259 | } | ||
1260 | } | ||
1071 | impl AstNode for IfExpr { | 1261 | impl AstNode for IfExpr { |
1072 | fn can_cast(kind: SyntaxKind) -> bool { | 1262 | fn can_cast(kind: SyntaxKind) -> bool { |
1073 | match kind { | 1263 | match kind { |
@@ -1095,6 +1285,11 @@ impl IfExpr { | |||
1095 | pub struct LoopExpr { | 1285 | pub struct LoopExpr { |
1096 | pub(crate) syntax: SyntaxNode, | 1286 | pub(crate) syntax: SyntaxNode, |
1097 | } | 1287 | } |
1288 | impl std::fmt::Display for LoopExpr { | ||
1289 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1290 | std::fmt::Display::fmt(self.syntax(), f) | ||
1291 | } | ||
1292 | } | ||
1098 | impl AstNode for LoopExpr { | 1293 | impl AstNode for LoopExpr { |
1099 | fn can_cast(kind: SyntaxKind) -> bool { | 1294 | fn can_cast(kind: SyntaxKind) -> bool { |
1100 | match kind { | 1295 | match kind { |
@@ -1119,6 +1314,11 @@ impl LoopExpr {} | |||
1119 | pub struct TryBlockExpr { | 1314 | pub struct TryBlockExpr { |
1120 | pub(crate) syntax: SyntaxNode, | 1315 | pub(crate) syntax: SyntaxNode, |
1121 | } | 1316 | } |
1317 | impl std::fmt::Display for TryBlockExpr { | ||
1318 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1319 | std::fmt::Display::fmt(self.syntax(), f) | ||
1320 | } | ||
1321 | } | ||
1122 | impl AstNode for TryBlockExpr { | 1322 | impl AstNode for TryBlockExpr { |
1123 | fn can_cast(kind: SyntaxKind) -> bool { | 1323 | fn can_cast(kind: SyntaxKind) -> bool { |
1124 | match kind { | 1324 | match kind { |
@@ -1146,6 +1346,11 @@ impl TryBlockExpr { | |||
1146 | pub struct ForExpr { | 1346 | pub struct ForExpr { |
1147 | pub(crate) syntax: SyntaxNode, | 1347 | pub(crate) syntax: SyntaxNode, |
1148 | } | 1348 | } |
1349 | impl std::fmt::Display for ForExpr { | ||
1350 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1351 | std::fmt::Display::fmt(self.syntax(), f) | ||
1352 | } | ||
1353 | } | ||
1149 | impl AstNode for ForExpr { | 1354 | impl AstNode for ForExpr { |
1150 | fn can_cast(kind: SyntaxKind) -> bool { | 1355 | fn can_cast(kind: SyntaxKind) -> bool { |
1151 | match kind { | 1356 | match kind { |
@@ -1177,6 +1382,11 @@ impl ForExpr { | |||
1177 | pub struct WhileExpr { | 1382 | pub struct WhileExpr { |
1178 | pub(crate) syntax: SyntaxNode, | 1383 | pub(crate) syntax: SyntaxNode, |
1179 | } | 1384 | } |
1385 | impl std::fmt::Display for WhileExpr { | ||
1386 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1387 | std::fmt::Display::fmt(self.syntax(), f) | ||
1388 | } | ||
1389 | } | ||
1180 | impl AstNode for WhileExpr { | 1390 | impl AstNode for WhileExpr { |
1181 | fn can_cast(kind: SyntaxKind) -> bool { | 1391 | fn can_cast(kind: SyntaxKind) -> bool { |
1182 | match kind { | 1392 | match kind { |
@@ -1205,6 +1415,11 @@ impl WhileExpr { | |||
1205 | pub struct ContinueExpr { | 1415 | pub struct ContinueExpr { |
1206 | pub(crate) syntax: SyntaxNode, | 1416 | pub(crate) syntax: SyntaxNode, |
1207 | } | 1417 | } |
1418 | impl std::fmt::Display for ContinueExpr { | ||
1419 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1420 | std::fmt::Display::fmt(self.syntax(), f) | ||
1421 | } | ||
1422 | } | ||
1208 | impl AstNode for ContinueExpr { | 1423 | impl AstNode for ContinueExpr { |
1209 | fn can_cast(kind: SyntaxKind) -> bool { | 1424 | fn can_cast(kind: SyntaxKind) -> bool { |
1210 | match kind { | 1425 | match kind { |
@@ -1228,6 +1443,11 @@ impl ContinueExpr {} | |||
1228 | pub struct BreakExpr { | 1443 | pub struct BreakExpr { |
1229 | pub(crate) syntax: SyntaxNode, | 1444 | pub(crate) syntax: SyntaxNode, |
1230 | } | 1445 | } |
1446 | impl std::fmt::Display for BreakExpr { | ||
1447 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1448 | std::fmt::Display::fmt(self.syntax(), f) | ||
1449 | } | ||
1450 | } | ||
1231 | impl AstNode for BreakExpr { | 1451 | impl AstNode for BreakExpr { |
1232 | fn can_cast(kind: SyntaxKind) -> bool { | 1452 | fn can_cast(kind: SyntaxKind) -> bool { |
1233 | match kind { | 1453 | match kind { |
@@ -1255,6 +1475,11 @@ impl BreakExpr { | |||
1255 | pub struct Label { | 1475 | pub struct Label { |
1256 | pub(crate) syntax: SyntaxNode, | 1476 | pub(crate) syntax: SyntaxNode, |
1257 | } | 1477 | } |
1478 | impl std::fmt::Display for Label { | ||
1479 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1480 | std::fmt::Display::fmt(self.syntax(), f) | ||
1481 | } | ||
1482 | } | ||
1258 | impl AstNode for Label { | 1483 | impl AstNode for Label { |
1259 | fn can_cast(kind: SyntaxKind) -> bool { | 1484 | fn can_cast(kind: SyntaxKind) -> bool { |
1260 | match kind { | 1485 | match kind { |
@@ -1278,6 +1503,11 @@ impl Label {} | |||
1278 | pub struct BlockExpr { | 1503 | pub struct BlockExpr { |
1279 | pub(crate) syntax: SyntaxNode, | 1504 | pub(crate) syntax: SyntaxNode, |
1280 | } | 1505 | } |
1506 | impl std::fmt::Display for BlockExpr { | ||
1507 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1508 | std::fmt::Display::fmt(self.syntax(), f) | ||
1509 | } | ||
1510 | } | ||
1281 | impl AstNode for BlockExpr { | 1511 | impl AstNode for BlockExpr { |
1282 | fn can_cast(kind: SyntaxKind) -> bool { | 1512 | fn can_cast(kind: SyntaxKind) -> bool { |
1283 | match kind { | 1513 | match kind { |
@@ -1305,6 +1535,11 @@ impl BlockExpr { | |||
1305 | pub struct ReturnExpr { | 1535 | pub struct ReturnExpr { |
1306 | pub(crate) syntax: SyntaxNode, | 1536 | pub(crate) syntax: SyntaxNode, |
1307 | } | 1537 | } |
1538 | impl std::fmt::Display for ReturnExpr { | ||
1539 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1540 | std::fmt::Display::fmt(self.syntax(), f) | ||
1541 | } | ||
1542 | } | ||
1308 | impl AstNode for ReturnExpr { | 1543 | impl AstNode for ReturnExpr { |
1309 | fn can_cast(kind: SyntaxKind) -> bool { | 1544 | fn can_cast(kind: SyntaxKind) -> bool { |
1310 | match kind { | 1545 | match kind { |
@@ -1332,6 +1567,11 @@ impl ReturnExpr { | |||
1332 | pub struct CallExpr { | 1567 | pub struct CallExpr { |
1333 | pub(crate) syntax: SyntaxNode, | 1568 | pub(crate) syntax: SyntaxNode, |
1334 | } | 1569 | } |
1570 | impl std::fmt::Display for CallExpr { | ||
1571 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1572 | std::fmt::Display::fmt(self.syntax(), f) | ||
1573 | } | ||
1574 | } | ||
1335 | impl AstNode for CallExpr { | 1575 | impl AstNode for CallExpr { |
1336 | fn can_cast(kind: SyntaxKind) -> bool { | 1576 | fn can_cast(kind: SyntaxKind) -> bool { |
1337 | match kind { | 1577 | match kind { |
@@ -1360,6 +1600,11 @@ impl CallExpr { | |||
1360 | pub struct MethodCallExpr { | 1600 | pub struct MethodCallExpr { |
1361 | pub(crate) syntax: SyntaxNode, | 1601 | pub(crate) syntax: SyntaxNode, |
1362 | } | 1602 | } |
1603 | impl std::fmt::Display for MethodCallExpr { | ||
1604 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1605 | std::fmt::Display::fmt(self.syntax(), f) | ||
1606 | } | ||
1607 | } | ||
1363 | impl AstNode for MethodCallExpr { | 1608 | impl AstNode for MethodCallExpr { |
1364 | fn can_cast(kind: SyntaxKind) -> bool { | 1609 | fn can_cast(kind: SyntaxKind) -> bool { |
1365 | match kind { | 1610 | match kind { |
@@ -1394,6 +1639,11 @@ impl MethodCallExpr { | |||
1394 | pub struct IndexExpr { | 1639 | pub struct IndexExpr { |
1395 | pub(crate) syntax: SyntaxNode, | 1640 | pub(crate) syntax: SyntaxNode, |
1396 | } | 1641 | } |
1642 | impl std::fmt::Display for IndexExpr { | ||
1643 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1644 | std::fmt::Display::fmt(self.syntax(), f) | ||
1645 | } | ||
1646 | } | ||
1397 | impl AstNode for IndexExpr { | 1647 | impl AstNode for IndexExpr { |
1398 | fn can_cast(kind: SyntaxKind) -> bool { | 1648 | fn can_cast(kind: SyntaxKind) -> bool { |
1399 | match kind { | 1649 | match kind { |
@@ -1417,6 +1667,11 @@ impl IndexExpr {} | |||
1417 | pub struct FieldExpr { | 1667 | pub struct FieldExpr { |
1418 | pub(crate) syntax: SyntaxNode, | 1668 | pub(crate) syntax: SyntaxNode, |
1419 | } | 1669 | } |
1670 | impl std::fmt::Display for FieldExpr { | ||
1671 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1672 | std::fmt::Display::fmt(self.syntax(), f) | ||
1673 | } | ||
1674 | } | ||
1420 | impl AstNode for FieldExpr { | 1675 | impl AstNode for FieldExpr { |
1421 | fn can_cast(kind: SyntaxKind) -> bool { | 1676 | fn can_cast(kind: SyntaxKind) -> bool { |
1422 | match kind { | 1677 | match kind { |
@@ -1447,6 +1702,11 @@ impl FieldExpr { | |||
1447 | pub struct AwaitExpr { | 1702 | pub struct AwaitExpr { |
1448 | pub(crate) syntax: SyntaxNode, | 1703 | pub(crate) syntax: SyntaxNode, |
1449 | } | 1704 | } |
1705 | impl std::fmt::Display for AwaitExpr { | ||
1706 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1707 | std::fmt::Display::fmt(self.syntax(), f) | ||
1708 | } | ||
1709 | } | ||
1450 | impl AstNode for AwaitExpr { | 1710 | impl AstNode for AwaitExpr { |
1451 | fn can_cast(kind: SyntaxKind) -> bool { | 1711 | fn can_cast(kind: SyntaxKind) -> bool { |
1452 | match kind { | 1712 | match kind { |
@@ -1474,6 +1734,11 @@ impl AwaitExpr { | |||
1474 | pub struct TryExpr { | 1734 | pub struct TryExpr { |
1475 | pub(crate) syntax: SyntaxNode, | 1735 | pub(crate) syntax: SyntaxNode, |
1476 | } | 1736 | } |
1737 | impl std::fmt::Display for TryExpr { | ||
1738 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1739 | std::fmt::Display::fmt(self.syntax(), f) | ||
1740 | } | ||
1741 | } | ||
1477 | impl AstNode for TryExpr { | 1742 | impl AstNode for TryExpr { |
1478 | fn can_cast(kind: SyntaxKind) -> bool { | 1743 | fn can_cast(kind: SyntaxKind) -> bool { |
1479 | match kind { | 1744 | match kind { |
@@ -1501,6 +1766,11 @@ impl TryExpr { | |||
1501 | pub struct CastExpr { | 1766 | pub struct CastExpr { |
1502 | pub(crate) syntax: SyntaxNode, | 1767 | pub(crate) syntax: SyntaxNode, |
1503 | } | 1768 | } |
1769 | impl std::fmt::Display for CastExpr { | ||
1770 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1771 | std::fmt::Display::fmt(self.syntax(), f) | ||
1772 | } | ||
1773 | } | ||
1504 | impl AstNode for CastExpr { | 1774 | impl AstNode for CastExpr { |
1505 | fn can_cast(kind: SyntaxKind) -> bool { | 1775 | fn can_cast(kind: SyntaxKind) -> bool { |
1506 | match kind { | 1776 | match kind { |
@@ -1531,6 +1801,11 @@ impl CastExpr { | |||
1531 | pub struct RefExpr { | 1801 | pub struct RefExpr { |
1532 | pub(crate) syntax: SyntaxNode, | 1802 | pub(crate) syntax: SyntaxNode, |
1533 | } | 1803 | } |
1804 | impl std::fmt::Display for RefExpr { | ||
1805 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1806 | std::fmt::Display::fmt(self.syntax(), f) | ||
1807 | } | ||
1808 | } | ||
1534 | impl AstNode for RefExpr { | 1809 | impl AstNode for RefExpr { |
1535 | fn can_cast(kind: SyntaxKind) -> bool { | 1810 | fn can_cast(kind: SyntaxKind) -> bool { |
1536 | match kind { | 1811 | match kind { |
@@ -1558,6 +1833,11 @@ impl RefExpr { | |||
1558 | pub struct PrefixExpr { | 1833 | pub struct PrefixExpr { |
1559 | pub(crate) syntax: SyntaxNode, | 1834 | pub(crate) syntax: SyntaxNode, |
1560 | } | 1835 | } |
1836 | impl std::fmt::Display for PrefixExpr { | ||
1837 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1838 | std::fmt::Display::fmt(self.syntax(), f) | ||
1839 | } | ||
1840 | } | ||
1561 | impl AstNode for PrefixExpr { | 1841 | impl AstNode for PrefixExpr { |
1562 | fn can_cast(kind: SyntaxKind) -> bool { | 1842 | fn can_cast(kind: SyntaxKind) -> bool { |
1563 | match kind { | 1843 | match kind { |
@@ -1585,6 +1865,11 @@ impl PrefixExpr { | |||
1585 | pub struct BoxExpr { | 1865 | pub struct BoxExpr { |
1586 | pub(crate) syntax: SyntaxNode, | 1866 | pub(crate) syntax: SyntaxNode, |
1587 | } | 1867 | } |
1868 | impl std::fmt::Display for BoxExpr { | ||
1869 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1870 | std::fmt::Display::fmt(self.syntax(), f) | ||
1871 | } | ||
1872 | } | ||
1588 | impl AstNode for BoxExpr { | 1873 | impl AstNode for BoxExpr { |
1589 | fn can_cast(kind: SyntaxKind) -> bool { | 1874 | fn can_cast(kind: SyntaxKind) -> bool { |
1590 | match kind { | 1875 | match kind { |
@@ -1612,6 +1897,11 @@ impl BoxExpr { | |||
1612 | pub struct RangeExpr { | 1897 | pub struct RangeExpr { |
1613 | pub(crate) syntax: SyntaxNode, | 1898 | pub(crate) syntax: SyntaxNode, |
1614 | } | 1899 | } |
1900 | impl std::fmt::Display for RangeExpr { | ||
1901 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1902 | std::fmt::Display::fmt(self.syntax(), f) | ||
1903 | } | ||
1904 | } | ||
1615 | impl AstNode for RangeExpr { | 1905 | impl AstNode for RangeExpr { |
1616 | fn can_cast(kind: SyntaxKind) -> bool { | 1906 | fn can_cast(kind: SyntaxKind) -> bool { |
1617 | match kind { | 1907 | match kind { |
@@ -1635,6 +1925,11 @@ impl RangeExpr {} | |||
1635 | pub struct BinExpr { | 1925 | pub struct BinExpr { |
1636 | pub(crate) syntax: SyntaxNode, | 1926 | pub(crate) syntax: SyntaxNode, |
1637 | } | 1927 | } |
1928 | impl std::fmt::Display for BinExpr { | ||
1929 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1930 | std::fmt::Display::fmt(self.syntax(), f) | ||
1931 | } | ||
1932 | } | ||
1638 | impl AstNode for BinExpr { | 1933 | impl AstNode for BinExpr { |
1639 | fn can_cast(kind: SyntaxKind) -> bool { | 1934 | fn can_cast(kind: SyntaxKind) -> bool { |
1640 | match kind { | 1935 | match kind { |
@@ -1658,6 +1953,11 @@ impl BinExpr {} | |||
1658 | pub struct Literal { | 1953 | pub struct Literal { |
1659 | pub(crate) syntax: SyntaxNode, | 1954 | pub(crate) syntax: SyntaxNode, |
1660 | } | 1955 | } |
1956 | impl std::fmt::Display for Literal { | ||
1957 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1958 | std::fmt::Display::fmt(self.syntax(), f) | ||
1959 | } | ||
1960 | } | ||
1661 | impl AstNode for Literal { | 1961 | impl AstNode for Literal { |
1662 | fn can_cast(kind: SyntaxKind) -> bool { | 1962 | fn can_cast(kind: SyntaxKind) -> bool { |
1663 | match kind { | 1963 | match kind { |
@@ -1681,6 +1981,11 @@ impl Literal {} | |||
1681 | pub struct MatchExpr { | 1981 | pub struct MatchExpr { |
1682 | pub(crate) syntax: SyntaxNode, | 1982 | pub(crate) syntax: SyntaxNode, |
1683 | } | 1983 | } |
1984 | impl std::fmt::Display for MatchExpr { | ||
1985 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1986 | std::fmt::Display::fmt(self.syntax(), f) | ||
1987 | } | ||
1988 | } | ||
1684 | impl AstNode for MatchExpr { | 1989 | impl AstNode for MatchExpr { |
1685 | fn can_cast(kind: SyntaxKind) -> bool { | 1990 | fn can_cast(kind: SyntaxKind) -> bool { |
1686 | match kind { | 1991 | match kind { |
@@ -1711,6 +2016,11 @@ impl MatchExpr { | |||
1711 | pub struct MatchArmList { | 2016 | pub struct MatchArmList { |
1712 | pub(crate) syntax: SyntaxNode, | 2017 | pub(crate) syntax: SyntaxNode, |
1713 | } | 2018 | } |
2019 | impl std::fmt::Display for MatchArmList { | ||
2020 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2021 | std::fmt::Display::fmt(self.syntax(), f) | ||
2022 | } | ||
2023 | } | ||
1714 | impl AstNode for MatchArmList { | 2024 | impl AstNode for MatchArmList { |
1715 | fn can_cast(kind: SyntaxKind) -> bool { | 2025 | fn can_cast(kind: SyntaxKind) -> bool { |
1716 | match kind { | 2026 | match kind { |
@@ -1739,6 +2049,11 @@ impl MatchArmList { | |||
1739 | pub struct MatchArm { | 2049 | pub struct MatchArm { |
1740 | pub(crate) syntax: SyntaxNode, | 2050 | pub(crate) syntax: SyntaxNode, |
1741 | } | 2051 | } |
2052 | impl std::fmt::Display for MatchArm { | ||
2053 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2054 | std::fmt::Display::fmt(self.syntax(), f) | ||
2055 | } | ||
2056 | } | ||
1742 | impl AstNode for MatchArm { | 2057 | impl AstNode for MatchArm { |
1743 | fn can_cast(kind: SyntaxKind) -> bool { | 2058 | fn can_cast(kind: SyntaxKind) -> bool { |
1744 | match kind { | 2059 | match kind { |
@@ -1773,6 +2088,11 @@ impl MatchArm { | |||
1773 | pub struct MatchGuard { | 2088 | pub struct MatchGuard { |
1774 | pub(crate) syntax: SyntaxNode, | 2089 | pub(crate) syntax: SyntaxNode, |
1775 | } | 2090 | } |
2091 | impl std::fmt::Display for MatchGuard { | ||
2092 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2093 | std::fmt::Display::fmt(self.syntax(), f) | ||
2094 | } | ||
2095 | } | ||
1776 | impl AstNode for MatchGuard { | 2096 | impl AstNode for MatchGuard { |
1777 | fn can_cast(kind: SyntaxKind) -> bool { | 2097 | fn can_cast(kind: SyntaxKind) -> bool { |
1778 | match kind { | 2098 | match kind { |
@@ -1800,6 +2120,11 @@ impl MatchGuard { | |||
1800 | pub struct RecordLit { | 2120 | pub struct RecordLit { |
1801 | pub(crate) syntax: SyntaxNode, | 2121 | pub(crate) syntax: SyntaxNode, |
1802 | } | 2122 | } |
2123 | impl std::fmt::Display for RecordLit { | ||
2124 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2125 | std::fmt::Display::fmt(self.syntax(), f) | ||
2126 | } | ||
2127 | } | ||
1803 | impl AstNode for RecordLit { | 2128 | impl AstNode for RecordLit { |
1804 | fn can_cast(kind: SyntaxKind) -> bool { | 2129 | fn can_cast(kind: SyntaxKind) -> bool { |
1805 | match kind { | 2130 | match kind { |
@@ -1830,6 +2155,11 @@ impl RecordLit { | |||
1830 | pub struct RecordFieldList { | 2155 | pub struct RecordFieldList { |
1831 | pub(crate) syntax: SyntaxNode, | 2156 | pub(crate) syntax: SyntaxNode, |
1832 | } | 2157 | } |
2158 | impl std::fmt::Display for RecordFieldList { | ||
2159 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2160 | std::fmt::Display::fmt(self.syntax(), f) | ||
2161 | } | ||
2162 | } | ||
1833 | impl AstNode for RecordFieldList { | 2163 | impl AstNode for RecordFieldList { |
1834 | fn can_cast(kind: SyntaxKind) -> bool { | 2164 | fn can_cast(kind: SyntaxKind) -> bool { |
1835 | match kind { | 2165 | match kind { |
@@ -1860,6 +2190,11 @@ impl RecordFieldList { | |||
1860 | pub struct RecordField { | 2190 | pub struct RecordField { |
1861 | pub(crate) syntax: SyntaxNode, | 2191 | pub(crate) syntax: SyntaxNode, |
1862 | } | 2192 | } |
2193 | impl std::fmt::Display for RecordField { | ||
2194 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2195 | std::fmt::Display::fmt(self.syntax(), f) | ||
2196 | } | ||
2197 | } | ||
1863 | impl AstNode for RecordField { | 2198 | impl AstNode for RecordField { |
1864 | fn can_cast(kind: SyntaxKind) -> bool { | 2199 | fn can_cast(kind: SyntaxKind) -> bool { |
1865 | match kind { | 2200 | match kind { |
@@ -1890,6 +2225,11 @@ impl RecordField { | |||
1890 | pub struct OrPat { | 2225 | pub struct OrPat { |
1891 | pub(crate) syntax: SyntaxNode, | 2226 | pub(crate) syntax: SyntaxNode, |
1892 | } | 2227 | } |
2228 | impl std::fmt::Display for OrPat { | ||
2229 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2230 | std::fmt::Display::fmt(self.syntax(), f) | ||
2231 | } | ||
2232 | } | ||
1893 | impl AstNode for OrPat { | 2233 | impl AstNode for OrPat { |
1894 | fn can_cast(kind: SyntaxKind) -> bool { | 2234 | fn can_cast(kind: SyntaxKind) -> bool { |
1895 | match kind { | 2235 | match kind { |
@@ -1917,6 +2257,11 @@ impl OrPat { | |||
1917 | pub struct ParenPat { | 2257 | pub struct ParenPat { |
1918 | pub(crate) syntax: SyntaxNode, | 2258 | pub(crate) syntax: SyntaxNode, |
1919 | } | 2259 | } |
2260 | impl std::fmt::Display for ParenPat { | ||
2261 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2262 | std::fmt::Display::fmt(self.syntax(), f) | ||
2263 | } | ||
2264 | } | ||
1920 | impl AstNode for ParenPat { | 2265 | impl AstNode for ParenPat { |
1921 | fn can_cast(kind: SyntaxKind) -> bool { | 2266 | fn can_cast(kind: SyntaxKind) -> bool { |
1922 | match kind { | 2267 | match kind { |
@@ -1944,6 +2289,11 @@ impl ParenPat { | |||
1944 | pub struct RefPat { | 2289 | pub struct RefPat { |
1945 | pub(crate) syntax: SyntaxNode, | 2290 | pub(crate) syntax: SyntaxNode, |
1946 | } | 2291 | } |
2292 | impl std::fmt::Display for RefPat { | ||
2293 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2294 | std::fmt::Display::fmt(self.syntax(), f) | ||
2295 | } | ||
2296 | } | ||
1947 | impl AstNode for RefPat { | 2297 | impl AstNode for RefPat { |
1948 | fn can_cast(kind: SyntaxKind) -> bool { | 2298 | fn can_cast(kind: SyntaxKind) -> bool { |
1949 | match kind { | 2299 | match kind { |
@@ -1971,6 +2321,11 @@ impl RefPat { | |||
1971 | pub struct BoxPat { | 2321 | pub struct BoxPat { |
1972 | pub(crate) syntax: SyntaxNode, | 2322 | pub(crate) syntax: SyntaxNode, |
1973 | } | 2323 | } |
2324 | impl std::fmt::Display for BoxPat { | ||
2325 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2326 | std::fmt::Display::fmt(self.syntax(), f) | ||
2327 | } | ||
2328 | } | ||
1974 | impl AstNode for BoxPat { | 2329 | impl AstNode for BoxPat { |
1975 | fn can_cast(kind: SyntaxKind) -> bool { | 2330 | fn can_cast(kind: SyntaxKind) -> bool { |
1976 | match kind { | 2331 | match kind { |
@@ -1998,6 +2353,11 @@ impl BoxPat { | |||
1998 | pub struct BindPat { | 2353 | pub struct BindPat { |
1999 | pub(crate) syntax: SyntaxNode, | 2354 | pub(crate) syntax: SyntaxNode, |
2000 | } | 2355 | } |
2356 | impl std::fmt::Display for BindPat { | ||
2357 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2358 | std::fmt::Display::fmt(self.syntax(), f) | ||
2359 | } | ||
2360 | } | ||
2001 | impl AstNode for BindPat { | 2361 | impl AstNode for BindPat { |
2002 | fn can_cast(kind: SyntaxKind) -> bool { | 2362 | fn can_cast(kind: SyntaxKind) -> bool { |
2003 | match kind { | 2363 | match kind { |
@@ -2026,6 +2386,11 @@ impl BindPat { | |||
2026 | pub struct PlaceholderPat { | 2386 | pub struct PlaceholderPat { |
2027 | pub(crate) syntax: SyntaxNode, | 2387 | pub(crate) syntax: SyntaxNode, |
2028 | } | 2388 | } |
2389 | impl std::fmt::Display for PlaceholderPat { | ||
2390 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2391 | std::fmt::Display::fmt(self.syntax(), f) | ||
2392 | } | ||
2393 | } | ||
2029 | impl AstNode for PlaceholderPat { | 2394 | impl AstNode for PlaceholderPat { |
2030 | fn can_cast(kind: SyntaxKind) -> bool { | 2395 | fn can_cast(kind: SyntaxKind) -> bool { |
2031 | match kind { | 2396 | match kind { |
@@ -2049,6 +2414,11 @@ impl PlaceholderPat {} | |||
2049 | pub struct DotDotPat { | 2414 | pub struct DotDotPat { |
2050 | pub(crate) syntax: SyntaxNode, | 2415 | pub(crate) syntax: SyntaxNode, |
2051 | } | 2416 | } |
2417 | impl std::fmt::Display for DotDotPat { | ||
2418 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2419 | std::fmt::Display::fmt(self.syntax(), f) | ||
2420 | } | ||
2421 | } | ||
2052 | impl AstNode for DotDotPat { | 2422 | impl AstNode for DotDotPat { |
2053 | fn can_cast(kind: SyntaxKind) -> bool { | 2423 | fn can_cast(kind: SyntaxKind) -> bool { |
2054 | match kind { | 2424 | match kind { |
@@ -2072,6 +2442,11 @@ impl DotDotPat {} | |||
2072 | pub struct PathPat { | 2442 | pub struct PathPat { |
2073 | pub(crate) syntax: SyntaxNode, | 2443 | pub(crate) syntax: SyntaxNode, |
2074 | } | 2444 | } |
2445 | impl std::fmt::Display for PathPat { | ||
2446 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2447 | std::fmt::Display::fmt(self.syntax(), f) | ||
2448 | } | ||
2449 | } | ||
2075 | impl AstNode for PathPat { | 2450 | impl AstNode for PathPat { |
2076 | fn can_cast(kind: SyntaxKind) -> bool { | 2451 | fn can_cast(kind: SyntaxKind) -> bool { |
2077 | match kind { | 2452 | match kind { |
@@ -2099,6 +2474,11 @@ impl PathPat { | |||
2099 | pub struct SlicePat { | 2474 | pub struct SlicePat { |
2100 | pub(crate) syntax: SyntaxNode, | 2475 | pub(crate) syntax: SyntaxNode, |
2101 | } | 2476 | } |
2477 | impl std::fmt::Display for SlicePat { | ||
2478 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2479 | std::fmt::Display::fmt(self.syntax(), f) | ||
2480 | } | ||
2481 | } | ||
2102 | impl AstNode for SlicePat { | 2482 | impl AstNode for SlicePat { |
2103 | fn can_cast(kind: SyntaxKind) -> bool { | 2483 | fn can_cast(kind: SyntaxKind) -> bool { |
2104 | match kind { | 2484 | match kind { |
@@ -2126,6 +2506,11 @@ impl SlicePat { | |||
2126 | pub struct RangePat { | 2506 | pub struct RangePat { |
2127 | pub(crate) syntax: SyntaxNode, | 2507 | pub(crate) syntax: SyntaxNode, |
2128 | } | 2508 | } |
2509 | impl std::fmt::Display for RangePat { | ||
2510 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2511 | std::fmt::Display::fmt(self.syntax(), f) | ||
2512 | } | ||
2513 | } | ||
2129 | impl AstNode for RangePat { | 2514 | impl AstNode for RangePat { |
2130 | fn can_cast(kind: SyntaxKind) -> bool { | 2515 | fn can_cast(kind: SyntaxKind) -> bool { |
2131 | match kind { | 2516 | match kind { |
@@ -2149,6 +2534,11 @@ impl RangePat {} | |||
2149 | pub struct LiteralPat { | 2534 | pub struct LiteralPat { |
2150 | pub(crate) syntax: SyntaxNode, | 2535 | pub(crate) syntax: SyntaxNode, |
2151 | } | 2536 | } |
2537 | impl std::fmt::Display for LiteralPat { | ||
2538 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2539 | std::fmt::Display::fmt(self.syntax(), f) | ||
2540 | } | ||
2541 | } | ||
2152 | impl AstNode for LiteralPat { | 2542 | impl AstNode for LiteralPat { |
2153 | fn can_cast(kind: SyntaxKind) -> bool { | 2543 | fn can_cast(kind: SyntaxKind) -> bool { |
2154 | match kind { | 2544 | match kind { |
@@ -2176,6 +2566,11 @@ impl LiteralPat { | |||
2176 | pub struct RecordPat { | 2566 | pub struct RecordPat { |
2177 | pub(crate) syntax: SyntaxNode, | 2567 | pub(crate) syntax: SyntaxNode, |
2178 | } | 2568 | } |
2569 | impl std::fmt::Display for RecordPat { | ||
2570 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2571 | std::fmt::Display::fmt(self.syntax(), f) | ||
2572 | } | ||
2573 | } | ||
2179 | impl AstNode for RecordPat { | 2574 | impl AstNode for RecordPat { |
2180 | fn can_cast(kind: SyntaxKind) -> bool { | 2575 | fn can_cast(kind: SyntaxKind) -> bool { |
2181 | match kind { | 2576 | match kind { |
@@ -2206,6 +2601,11 @@ impl RecordPat { | |||
2206 | pub struct RecordFieldPatList { | 2601 | pub struct RecordFieldPatList { |
2207 | pub(crate) syntax: SyntaxNode, | 2602 | pub(crate) syntax: SyntaxNode, |
2208 | } | 2603 | } |
2604 | impl std::fmt::Display for RecordFieldPatList { | ||
2605 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2606 | std::fmt::Display::fmt(self.syntax(), f) | ||
2607 | } | ||
2608 | } | ||
2209 | impl AstNode for RecordFieldPatList { | 2609 | impl AstNode for RecordFieldPatList { |
2210 | fn can_cast(kind: SyntaxKind) -> bool { | 2610 | fn can_cast(kind: SyntaxKind) -> bool { |
2211 | match kind { | 2611 | match kind { |
@@ -2236,6 +2636,11 @@ impl RecordFieldPatList { | |||
2236 | pub struct RecordFieldPat { | 2636 | pub struct RecordFieldPat { |
2237 | pub(crate) syntax: SyntaxNode, | 2637 | pub(crate) syntax: SyntaxNode, |
2238 | } | 2638 | } |
2639 | impl std::fmt::Display for RecordFieldPat { | ||
2640 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2641 | std::fmt::Display::fmt(self.syntax(), f) | ||
2642 | } | ||
2643 | } | ||
2239 | impl AstNode for RecordFieldPat { | 2644 | impl AstNode for RecordFieldPat { |
2240 | fn can_cast(kind: SyntaxKind) -> bool { | 2645 | fn can_cast(kind: SyntaxKind) -> bool { |
2241 | match kind { | 2646 | match kind { |
@@ -2264,6 +2669,11 @@ impl RecordFieldPat { | |||
2264 | pub struct TupleStructPat { | 2669 | pub struct TupleStructPat { |
2265 | pub(crate) syntax: SyntaxNode, | 2670 | pub(crate) syntax: SyntaxNode, |
2266 | } | 2671 | } |
2672 | impl std::fmt::Display for TupleStructPat { | ||
2673 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2674 | std::fmt::Display::fmt(self.syntax(), f) | ||
2675 | } | ||
2676 | } | ||
2267 | impl AstNode for TupleStructPat { | 2677 | impl AstNode for TupleStructPat { |
2268 | fn can_cast(kind: SyntaxKind) -> bool { | 2678 | fn can_cast(kind: SyntaxKind) -> bool { |
2269 | match kind { | 2679 | match kind { |
@@ -2294,6 +2704,11 @@ impl TupleStructPat { | |||
2294 | pub struct TuplePat { | 2704 | pub struct TuplePat { |
2295 | pub(crate) syntax: SyntaxNode, | 2705 | pub(crate) syntax: SyntaxNode, |
2296 | } | 2706 | } |
2707 | impl std::fmt::Display for TuplePat { | ||
2708 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2709 | std::fmt::Display::fmt(self.syntax(), f) | ||
2710 | } | ||
2711 | } | ||
2297 | impl AstNode for TuplePat { | 2712 | impl AstNode for TuplePat { |
2298 | fn can_cast(kind: SyntaxKind) -> bool { | 2713 | fn can_cast(kind: SyntaxKind) -> bool { |
2299 | match kind { | 2714 | match kind { |
@@ -2321,6 +2736,11 @@ impl TuplePat { | |||
2321 | pub struct Visibility { | 2736 | pub struct Visibility { |
2322 | pub(crate) syntax: SyntaxNode, | 2737 | pub(crate) syntax: SyntaxNode, |
2323 | } | 2738 | } |
2739 | impl std::fmt::Display for Visibility { | ||
2740 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2741 | std::fmt::Display::fmt(self.syntax(), f) | ||
2742 | } | ||
2743 | } | ||
2324 | impl AstNode for Visibility { | 2744 | impl AstNode for Visibility { |
2325 | fn can_cast(kind: SyntaxKind) -> bool { | 2745 | fn can_cast(kind: SyntaxKind) -> bool { |
2326 | match kind { | 2746 | match kind { |
@@ -2344,6 +2764,11 @@ impl Visibility {} | |||
2344 | pub struct Name { | 2764 | pub struct Name { |
2345 | pub(crate) syntax: SyntaxNode, | 2765 | pub(crate) syntax: SyntaxNode, |
2346 | } | 2766 | } |
2767 | impl std::fmt::Display for Name { | ||
2768 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2769 | std::fmt::Display::fmt(self.syntax(), f) | ||
2770 | } | ||
2771 | } | ||
2347 | impl AstNode for Name { | 2772 | impl AstNode for Name { |
2348 | fn can_cast(kind: SyntaxKind) -> bool { | 2773 | fn can_cast(kind: SyntaxKind) -> bool { |
2349 | match kind { | 2774 | match kind { |
@@ -2367,6 +2792,11 @@ impl Name {} | |||
2367 | pub struct NameRef { | 2792 | pub struct NameRef { |
2368 | pub(crate) syntax: SyntaxNode, | 2793 | pub(crate) syntax: SyntaxNode, |
2369 | } | 2794 | } |
2795 | impl std::fmt::Display for NameRef { | ||
2796 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2797 | std::fmt::Display::fmt(self.syntax(), f) | ||
2798 | } | ||
2799 | } | ||
2370 | impl AstNode for NameRef { | 2800 | impl AstNode for NameRef { |
2371 | fn can_cast(kind: SyntaxKind) -> bool { | 2801 | fn can_cast(kind: SyntaxKind) -> bool { |
2372 | match kind { | 2802 | match kind { |
@@ -2390,6 +2820,11 @@ impl NameRef {} | |||
2390 | pub struct MacroCall { | 2820 | pub struct MacroCall { |
2391 | pub(crate) syntax: SyntaxNode, | 2821 | pub(crate) syntax: SyntaxNode, |
2392 | } | 2822 | } |
2823 | impl std::fmt::Display for MacroCall { | ||
2824 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2825 | std::fmt::Display::fmt(self.syntax(), f) | ||
2826 | } | ||
2827 | } | ||
2393 | impl AstNode for MacroCall { | 2828 | impl AstNode for MacroCall { |
2394 | fn can_cast(kind: SyntaxKind) -> bool { | 2829 | fn can_cast(kind: SyntaxKind) -> bool { |
2395 | match kind { | 2830 | match kind { |
@@ -2423,6 +2858,11 @@ impl MacroCall { | |||
2423 | pub struct Attr { | 2858 | pub struct Attr { |
2424 | pub(crate) syntax: SyntaxNode, | 2859 | pub(crate) syntax: SyntaxNode, |
2425 | } | 2860 | } |
2861 | impl std::fmt::Display for Attr { | ||
2862 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2863 | std::fmt::Display::fmt(self.syntax(), f) | ||
2864 | } | ||
2865 | } | ||
2426 | impl AstNode for Attr { | 2866 | impl AstNode for Attr { |
2427 | fn can_cast(kind: SyntaxKind) -> bool { | 2867 | fn can_cast(kind: SyntaxKind) -> bool { |
2428 | match kind { | 2868 | match kind { |
@@ -2453,6 +2893,11 @@ impl Attr { | |||
2453 | pub struct TokenTree { | 2893 | pub struct TokenTree { |
2454 | pub(crate) syntax: SyntaxNode, | 2894 | pub(crate) syntax: SyntaxNode, |
2455 | } | 2895 | } |
2896 | impl std::fmt::Display for TokenTree { | ||
2897 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2898 | std::fmt::Display::fmt(self.syntax(), f) | ||
2899 | } | ||
2900 | } | ||
2456 | impl AstNode for TokenTree { | 2901 | impl AstNode for TokenTree { |
2457 | fn can_cast(kind: SyntaxKind) -> bool { | 2902 | fn can_cast(kind: SyntaxKind) -> bool { |
2458 | match kind { | 2903 | match kind { |
@@ -2476,6 +2921,11 @@ impl TokenTree {} | |||
2476 | pub struct TypeParamList { | 2921 | pub struct TypeParamList { |
2477 | pub(crate) syntax: SyntaxNode, | 2922 | pub(crate) syntax: SyntaxNode, |
2478 | } | 2923 | } |
2924 | impl std::fmt::Display for TypeParamList { | ||
2925 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2926 | std::fmt::Display::fmt(self.syntax(), f) | ||
2927 | } | ||
2928 | } | ||
2479 | impl AstNode for TypeParamList { | 2929 | impl AstNode for TypeParamList { |
2480 | fn can_cast(kind: SyntaxKind) -> bool { | 2930 | fn can_cast(kind: SyntaxKind) -> bool { |
2481 | match kind { | 2931 | match kind { |
@@ -2506,6 +2956,11 @@ impl TypeParamList { | |||
2506 | pub struct TypeParam { | 2956 | pub struct TypeParam { |
2507 | pub(crate) syntax: SyntaxNode, | 2957 | pub(crate) syntax: SyntaxNode, |
2508 | } | 2958 | } |
2959 | impl std::fmt::Display for TypeParam { | ||
2960 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2961 | std::fmt::Display::fmt(self.syntax(), f) | ||
2962 | } | ||
2963 | } | ||
2509 | impl AstNode for TypeParam { | 2964 | impl AstNode for TypeParam { |
2510 | fn can_cast(kind: SyntaxKind) -> bool { | 2965 | fn can_cast(kind: SyntaxKind) -> bool { |
2511 | match kind { | 2966 | match kind { |
@@ -2536,6 +2991,11 @@ impl TypeParam { | |||
2536 | pub struct ConstParam { | 2991 | pub struct ConstParam { |
2537 | pub(crate) syntax: SyntaxNode, | 2992 | pub(crate) syntax: SyntaxNode, |
2538 | } | 2993 | } |
2994 | impl std::fmt::Display for ConstParam { | ||
2995 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2996 | std::fmt::Display::fmt(self.syntax(), f) | ||
2997 | } | ||
2998 | } | ||
2539 | impl AstNode for ConstParam { | 2999 | impl AstNode for ConstParam { |
2540 | fn can_cast(kind: SyntaxKind) -> bool { | 3000 | fn can_cast(kind: SyntaxKind) -> bool { |
2541 | match kind { | 3001 | match kind { |
@@ -2566,6 +3026,11 @@ impl ConstParam { | |||
2566 | pub struct LifetimeParam { | 3026 | pub struct LifetimeParam { |
2567 | pub(crate) syntax: SyntaxNode, | 3027 | pub(crate) syntax: SyntaxNode, |
2568 | } | 3028 | } |
3029 | impl std::fmt::Display for LifetimeParam { | ||
3030 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3031 | std::fmt::Display::fmt(self.syntax(), f) | ||
3032 | } | ||
3033 | } | ||
2569 | impl AstNode for LifetimeParam { | 3034 | impl AstNode for LifetimeParam { |
2570 | fn can_cast(kind: SyntaxKind) -> bool { | 3035 | fn can_cast(kind: SyntaxKind) -> bool { |
2571 | match kind { | 3036 | match kind { |
@@ -2590,6 +3055,11 @@ impl LifetimeParam {} | |||
2590 | pub struct TypeBound { | 3055 | pub struct TypeBound { |
2591 | pub(crate) syntax: SyntaxNode, | 3056 | pub(crate) syntax: SyntaxNode, |
2592 | } | 3057 | } |
3058 | impl std::fmt::Display for TypeBound { | ||
3059 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3060 | std::fmt::Display::fmt(self.syntax(), f) | ||
3061 | } | ||
3062 | } | ||
2593 | impl AstNode for TypeBound { | 3063 | impl AstNode for TypeBound { |
2594 | fn can_cast(kind: SyntaxKind) -> bool { | 3064 | fn can_cast(kind: SyntaxKind) -> bool { |
2595 | match kind { | 3065 | match kind { |
@@ -2617,6 +3087,11 @@ impl TypeBound { | |||
2617 | pub struct TypeBoundList { | 3087 | pub struct TypeBoundList { |
2618 | pub(crate) syntax: SyntaxNode, | 3088 | pub(crate) syntax: SyntaxNode, |
2619 | } | 3089 | } |
3090 | impl std::fmt::Display for TypeBoundList { | ||
3091 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3092 | std::fmt::Display::fmt(self.syntax(), f) | ||
3093 | } | ||
3094 | } | ||
2620 | impl AstNode for TypeBoundList { | 3095 | impl AstNode for TypeBoundList { |
2621 | fn can_cast(kind: SyntaxKind) -> bool { | 3096 | fn can_cast(kind: SyntaxKind) -> bool { |
2622 | match kind { | 3097 | match kind { |
@@ -2644,6 +3119,11 @@ impl TypeBoundList { | |||
2644 | pub struct WherePred { | 3119 | pub struct WherePred { |
2645 | pub(crate) syntax: SyntaxNode, | 3120 | pub(crate) syntax: SyntaxNode, |
2646 | } | 3121 | } |
3122 | impl std::fmt::Display for WherePred { | ||
3123 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3124 | std::fmt::Display::fmt(self.syntax(), f) | ||
3125 | } | ||
3126 | } | ||
2647 | impl AstNode for WherePred { | 3127 | impl AstNode for WherePred { |
2648 | fn can_cast(kind: SyntaxKind) -> bool { | 3128 | fn can_cast(kind: SyntaxKind) -> bool { |
2649 | match kind { | 3129 | match kind { |
@@ -2672,6 +3152,11 @@ impl WherePred { | |||
2672 | pub struct WhereClause { | 3152 | pub struct WhereClause { |
2673 | pub(crate) syntax: SyntaxNode, | 3153 | pub(crate) syntax: SyntaxNode, |
2674 | } | 3154 | } |
3155 | impl std::fmt::Display for WhereClause { | ||
3156 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3157 | std::fmt::Display::fmt(self.syntax(), f) | ||
3158 | } | ||
3159 | } | ||
2675 | impl AstNode for WhereClause { | 3160 | impl AstNode for WhereClause { |
2676 | fn can_cast(kind: SyntaxKind) -> bool { | 3161 | fn can_cast(kind: SyntaxKind) -> bool { |
2677 | match kind { | 3162 | match kind { |
@@ -2699,6 +3184,11 @@ impl WhereClause { | |||
2699 | pub struct ExprStmt { | 3184 | pub struct ExprStmt { |
2700 | pub(crate) syntax: SyntaxNode, | 3185 | pub(crate) syntax: SyntaxNode, |
2701 | } | 3186 | } |
3187 | impl std::fmt::Display for ExprStmt { | ||
3188 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3189 | std::fmt::Display::fmt(self.syntax(), f) | ||
3190 | } | ||
3191 | } | ||
2702 | impl AstNode for ExprStmt { | 3192 | impl AstNode for ExprStmt { |
2703 | fn can_cast(kind: SyntaxKind) -> bool { | 3193 | fn can_cast(kind: SyntaxKind) -> bool { |
2704 | match kind { | 3194 | match kind { |
@@ -2726,6 +3216,11 @@ impl ExprStmt { | |||
2726 | pub struct LetStmt { | 3216 | pub struct LetStmt { |
2727 | pub(crate) syntax: SyntaxNode, | 3217 | pub(crate) syntax: SyntaxNode, |
2728 | } | 3218 | } |
3219 | impl std::fmt::Display for LetStmt { | ||
3220 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3221 | std::fmt::Display::fmt(self.syntax(), f) | ||
3222 | } | ||
3223 | } | ||
2729 | impl AstNode for LetStmt { | 3224 | impl AstNode for LetStmt { |
2730 | fn can_cast(kind: SyntaxKind) -> bool { | 3225 | fn can_cast(kind: SyntaxKind) -> bool { |
2731 | match kind { | 3226 | match kind { |
@@ -2757,6 +3252,11 @@ impl LetStmt { | |||
2757 | pub struct Condition { | 3252 | pub struct Condition { |
2758 | pub(crate) syntax: SyntaxNode, | 3253 | pub(crate) syntax: SyntaxNode, |
2759 | } | 3254 | } |
3255 | impl std::fmt::Display for Condition { | ||
3256 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3257 | std::fmt::Display::fmt(self.syntax(), f) | ||
3258 | } | ||
3259 | } | ||
2760 | impl AstNode for Condition { | 3260 | impl AstNode for Condition { |
2761 | fn can_cast(kind: SyntaxKind) -> bool { | 3261 | fn can_cast(kind: SyntaxKind) -> bool { |
2762 | match kind { | 3262 | match kind { |
@@ -2787,6 +3287,11 @@ impl Condition { | |||
2787 | pub struct Block { | 3287 | pub struct Block { |
2788 | pub(crate) syntax: SyntaxNode, | 3288 | pub(crate) syntax: SyntaxNode, |
2789 | } | 3289 | } |
3290 | impl std::fmt::Display for Block { | ||
3291 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3292 | std::fmt::Display::fmt(self.syntax(), f) | ||
3293 | } | ||
3294 | } | ||
2790 | impl AstNode for Block { | 3295 | impl AstNode for Block { |
2791 | fn can_cast(kind: SyntaxKind) -> bool { | 3296 | fn can_cast(kind: SyntaxKind) -> bool { |
2792 | match kind { | 3297 | match kind { |
@@ -2819,6 +3324,11 @@ impl Block { | |||
2819 | pub struct ParamList { | 3324 | pub struct ParamList { |
2820 | pub(crate) syntax: SyntaxNode, | 3325 | pub(crate) syntax: SyntaxNode, |
2821 | } | 3326 | } |
3327 | impl std::fmt::Display for ParamList { | ||
3328 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3329 | std::fmt::Display::fmt(self.syntax(), f) | ||
3330 | } | ||
3331 | } | ||
2822 | impl AstNode for ParamList { | 3332 | impl AstNode for ParamList { |
2823 | fn can_cast(kind: SyntaxKind) -> bool { | 3333 | fn can_cast(kind: SyntaxKind) -> bool { |
2824 | match kind { | 3334 | match kind { |
@@ -2849,6 +3359,11 @@ impl ParamList { | |||
2849 | pub struct SelfParam { | 3359 | pub struct SelfParam { |
2850 | pub(crate) syntax: SyntaxNode, | 3360 | pub(crate) syntax: SyntaxNode, |
2851 | } | 3361 | } |
3362 | impl std::fmt::Display for SelfParam { | ||
3363 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3364 | std::fmt::Display::fmt(self.syntax(), f) | ||
3365 | } | ||
3366 | } | ||
2852 | impl AstNode for SelfParam { | 3367 | impl AstNode for SelfParam { |
2853 | fn can_cast(kind: SyntaxKind) -> bool { | 3368 | fn can_cast(kind: SyntaxKind) -> bool { |
2854 | match kind { | 3369 | match kind { |
@@ -2874,6 +3389,11 @@ impl SelfParam {} | |||
2874 | pub struct Param { | 3389 | pub struct Param { |
2875 | pub(crate) syntax: SyntaxNode, | 3390 | pub(crate) syntax: SyntaxNode, |
2876 | } | 3391 | } |
3392 | impl std::fmt::Display for Param { | ||
3393 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3394 | std::fmt::Display::fmt(self.syntax(), f) | ||
3395 | } | ||
3396 | } | ||
2877 | impl AstNode for Param { | 3397 | impl AstNode for Param { |
2878 | fn can_cast(kind: SyntaxKind) -> bool { | 3398 | fn can_cast(kind: SyntaxKind) -> bool { |
2879 | match kind { | 3399 | match kind { |
@@ -2903,6 +3423,11 @@ impl Param { | |||
2903 | pub struct UseItem { | 3423 | pub struct UseItem { |
2904 | pub(crate) syntax: SyntaxNode, | 3424 | pub(crate) syntax: SyntaxNode, |
2905 | } | 3425 | } |
3426 | impl std::fmt::Display for UseItem { | ||
3427 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3428 | std::fmt::Display::fmt(self.syntax(), f) | ||
3429 | } | ||
3430 | } | ||
2906 | impl AstNode for UseItem { | 3431 | impl AstNode for UseItem { |
2907 | fn can_cast(kind: SyntaxKind) -> bool { | 3432 | fn can_cast(kind: SyntaxKind) -> bool { |
2908 | match kind { | 3433 | match kind { |
@@ -2932,6 +3457,11 @@ impl UseItem { | |||
2932 | pub struct UseTree { | 3457 | pub struct UseTree { |
2933 | pub(crate) syntax: SyntaxNode, | 3458 | pub(crate) syntax: SyntaxNode, |
2934 | } | 3459 | } |
3460 | impl std::fmt::Display for UseTree { | ||
3461 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3462 | std::fmt::Display::fmt(self.syntax(), f) | ||
3463 | } | ||
3464 | } | ||
2935 | impl AstNode for UseTree { | 3465 | impl AstNode for UseTree { |
2936 | fn can_cast(kind: SyntaxKind) -> bool { | 3466 | fn can_cast(kind: SyntaxKind) -> bool { |
2937 | match kind { | 3467 | match kind { |
@@ -2965,6 +3495,11 @@ impl UseTree { | |||
2965 | pub struct Alias { | 3495 | pub struct Alias { |
2966 | pub(crate) syntax: SyntaxNode, | 3496 | pub(crate) syntax: SyntaxNode, |
2967 | } | 3497 | } |
3498 | impl std::fmt::Display for Alias { | ||
3499 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3500 | std::fmt::Display::fmt(self.syntax(), f) | ||
3501 | } | ||
3502 | } | ||
2968 | impl AstNode for Alias { | 3503 | impl AstNode for Alias { |
2969 | fn can_cast(kind: SyntaxKind) -> bool { | 3504 | fn can_cast(kind: SyntaxKind) -> bool { |
2970 | match kind { | 3505 | match kind { |
@@ -2989,6 +3524,11 @@ impl Alias {} | |||
2989 | pub struct UseTreeList { | 3524 | pub struct UseTreeList { |
2990 | pub(crate) syntax: SyntaxNode, | 3525 | pub(crate) syntax: SyntaxNode, |
2991 | } | 3526 | } |
3527 | impl std::fmt::Display for UseTreeList { | ||
3528 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3529 | std::fmt::Display::fmt(self.syntax(), f) | ||
3530 | } | ||
3531 | } | ||
2992 | impl AstNode for UseTreeList { | 3532 | impl AstNode for UseTreeList { |
2993 | fn can_cast(kind: SyntaxKind) -> bool { | 3533 | fn can_cast(kind: SyntaxKind) -> bool { |
2994 | match kind { | 3534 | match kind { |
@@ -3016,6 +3556,11 @@ impl UseTreeList { | |||
3016 | pub struct ExternCrateItem { | 3556 | pub struct ExternCrateItem { |
3017 | pub(crate) syntax: SyntaxNode, | 3557 | pub(crate) syntax: SyntaxNode, |
3018 | } | 3558 | } |
3559 | impl std::fmt::Display for ExternCrateItem { | ||
3560 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3561 | std::fmt::Display::fmt(self.syntax(), f) | ||
3562 | } | ||
3563 | } | ||
3019 | impl AstNode for ExternCrateItem { | 3564 | impl AstNode for ExternCrateItem { |
3020 | fn can_cast(kind: SyntaxKind) -> bool { | 3565 | fn can_cast(kind: SyntaxKind) -> bool { |
3021 | match kind { | 3566 | match kind { |
@@ -3048,6 +3593,11 @@ impl ExternCrateItem { | |||
3048 | pub struct ArgList { | 3593 | pub struct ArgList { |
3049 | pub(crate) syntax: SyntaxNode, | 3594 | pub(crate) syntax: SyntaxNode, |
3050 | } | 3595 | } |
3596 | impl std::fmt::Display for ArgList { | ||
3597 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3598 | std::fmt::Display::fmt(self.syntax(), f) | ||
3599 | } | ||
3600 | } | ||
3051 | impl AstNode for ArgList { | 3601 | impl AstNode for ArgList { |
3052 | fn can_cast(kind: SyntaxKind) -> bool { | 3602 | fn can_cast(kind: SyntaxKind) -> bool { |
3053 | match kind { | 3603 | match kind { |
@@ -3075,6 +3625,11 @@ impl ArgList { | |||
3075 | pub struct Path { | 3625 | pub struct Path { |
3076 | pub(crate) syntax: SyntaxNode, | 3626 | pub(crate) syntax: SyntaxNode, |
3077 | } | 3627 | } |
3628 | impl std::fmt::Display for Path { | ||
3629 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3630 | std::fmt::Display::fmt(self.syntax(), f) | ||
3631 | } | ||
3632 | } | ||
3078 | impl AstNode for Path { | 3633 | impl AstNode for Path { |
3079 | fn can_cast(kind: SyntaxKind) -> bool { | 3634 | fn can_cast(kind: SyntaxKind) -> bool { |
3080 | match kind { | 3635 | match kind { |
@@ -3105,6 +3660,11 @@ impl Path { | |||
3105 | pub struct PathSegment { | 3660 | pub struct PathSegment { |
3106 | pub(crate) syntax: SyntaxNode, | 3661 | pub(crate) syntax: SyntaxNode, |
3107 | } | 3662 | } |
3663 | impl std::fmt::Display for PathSegment { | ||
3664 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3665 | std::fmt::Display::fmt(self.syntax(), f) | ||
3666 | } | ||
3667 | } | ||
3108 | impl AstNode for PathSegment { | 3668 | impl AstNode for PathSegment { |
3109 | fn can_cast(kind: SyntaxKind) -> bool { | 3669 | fn can_cast(kind: SyntaxKind) -> bool { |
3110 | match kind { | 3670 | match kind { |
@@ -3144,6 +3704,11 @@ impl PathSegment { | |||
3144 | pub struct TypeArgList { | 3704 | pub struct TypeArgList { |
3145 | pub(crate) syntax: SyntaxNode, | 3705 | pub(crate) syntax: SyntaxNode, |
3146 | } | 3706 | } |
3707 | impl std::fmt::Display for TypeArgList { | ||
3708 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3709 | std::fmt::Display::fmt(self.syntax(), f) | ||
3710 | } | ||
3711 | } | ||
3147 | impl AstNode for TypeArgList { | 3712 | impl AstNode for TypeArgList { |
3148 | fn can_cast(kind: SyntaxKind) -> bool { | 3713 | fn can_cast(kind: SyntaxKind) -> bool { |
3149 | match kind { | 3714 | match kind { |
@@ -3180,6 +3745,11 @@ impl TypeArgList { | |||
3180 | pub struct TypeArg { | 3745 | pub struct TypeArg { |
3181 | pub(crate) syntax: SyntaxNode, | 3746 | pub(crate) syntax: SyntaxNode, |
3182 | } | 3747 | } |
3748 | impl std::fmt::Display for TypeArg { | ||
3749 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3750 | std::fmt::Display::fmt(self.syntax(), f) | ||
3751 | } | ||
3752 | } | ||
3183 | impl AstNode for TypeArg { | 3753 | impl AstNode for TypeArg { |
3184 | fn can_cast(kind: SyntaxKind) -> bool { | 3754 | fn can_cast(kind: SyntaxKind) -> bool { |
3185 | match kind { | 3755 | match kind { |
@@ -3207,6 +3777,11 @@ impl TypeArg { | |||
3207 | pub struct AssocTypeArg { | 3777 | pub struct AssocTypeArg { |
3208 | pub(crate) syntax: SyntaxNode, | 3778 | pub(crate) syntax: SyntaxNode, |
3209 | } | 3779 | } |
3780 | impl std::fmt::Display for AssocTypeArg { | ||
3781 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3782 | std::fmt::Display::fmt(self.syntax(), f) | ||
3783 | } | ||
3784 | } | ||
3210 | impl AstNode for AssocTypeArg { | 3785 | impl AstNode for AssocTypeArg { |
3211 | fn can_cast(kind: SyntaxKind) -> bool { | 3786 | fn can_cast(kind: SyntaxKind) -> bool { |
3212 | match kind { | 3787 | match kind { |
@@ -3237,6 +3812,11 @@ impl AssocTypeArg { | |||
3237 | pub struct LifetimeArg { | 3812 | pub struct LifetimeArg { |
3238 | pub(crate) syntax: SyntaxNode, | 3813 | pub(crate) syntax: SyntaxNode, |
3239 | } | 3814 | } |
3815 | impl std::fmt::Display for LifetimeArg { | ||
3816 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3817 | std::fmt::Display::fmt(self.syntax(), f) | ||
3818 | } | ||
3819 | } | ||
3240 | impl AstNode for LifetimeArg { | 3820 | impl AstNode for LifetimeArg { |
3241 | fn can_cast(kind: SyntaxKind) -> bool { | 3821 | fn can_cast(kind: SyntaxKind) -> bool { |
3242 | match kind { | 3822 | match kind { |
@@ -3260,6 +3840,11 @@ impl LifetimeArg {} | |||
3260 | pub struct ConstArg { | 3840 | pub struct ConstArg { |
3261 | pub(crate) syntax: SyntaxNode, | 3841 | pub(crate) syntax: SyntaxNode, |
3262 | } | 3842 | } |
3843 | impl std::fmt::Display for ConstArg { | ||
3844 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3845 | std::fmt::Display::fmt(self.syntax(), f) | ||
3846 | } | ||
3847 | } | ||
3263 | impl AstNode for ConstArg { | 3848 | impl AstNode for ConstArg { |
3264 | fn can_cast(kind: SyntaxKind) -> bool { | 3849 | fn can_cast(kind: SyntaxKind) -> bool { |
3265 | match kind { | 3850 | match kind { |
@@ -3290,6 +3875,11 @@ impl ConstArg { | |||
3290 | pub struct MacroItems { | 3875 | pub struct MacroItems { |
3291 | pub(crate) syntax: SyntaxNode, | 3876 | pub(crate) syntax: SyntaxNode, |
3292 | } | 3877 | } |
3878 | impl std::fmt::Display for MacroItems { | ||
3879 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3880 | std::fmt::Display::fmt(self.syntax(), f) | ||
3881 | } | ||
3882 | } | ||
3293 | impl AstNode for MacroItems { | 3883 | impl AstNode for MacroItems { |
3294 | fn can_cast(kind: SyntaxKind) -> bool { | 3884 | fn can_cast(kind: SyntaxKind) -> bool { |
3295 | match kind { | 3885 | match kind { |
@@ -3315,6 +3905,11 @@ impl MacroItems {} | |||
3315 | pub struct MacroStmts { | 3905 | pub struct MacroStmts { |
3316 | pub(crate) syntax: SyntaxNode, | 3906 | pub(crate) syntax: SyntaxNode, |
3317 | } | 3907 | } |
3908 | impl std::fmt::Display for MacroStmts { | ||
3909 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3910 | std::fmt::Display::fmt(self.syntax(), f) | ||
3911 | } | ||
3912 | } | ||
3318 | impl AstNode for MacroStmts { | 3913 | impl AstNode for MacroStmts { |
3319 | fn can_cast(kind: SyntaxKind) -> bool { | 3914 | fn can_cast(kind: SyntaxKind) -> bool { |
3320 | match kind { | 3915 | match kind { |
@@ -3362,6 +3957,11 @@ impl From<UnionDef> for NominalDef { | |||
3362 | NominalDef::UnionDef(node) | 3957 | NominalDef::UnionDef(node) |
3363 | } | 3958 | } |
3364 | } | 3959 | } |
3960 | impl std::fmt::Display for NominalDef { | ||
3961 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3962 | std::fmt::Display::fmt(self.syntax(), f) | ||
3963 | } | ||
3964 | } | ||
3365 | impl AstNode for NominalDef { | 3965 | impl AstNode for NominalDef { |
3366 | fn can_cast(kind: SyntaxKind) -> bool { | 3966 | fn can_cast(kind: SyntaxKind) -> bool { |
3367 | match kind { | 3967 | match kind { |
@@ -3470,6 +4070,11 @@ impl From<DynTraitType> for TypeRef { | |||
3470 | TypeRef::DynTraitType(node) | 4070 | TypeRef::DynTraitType(node) |
3471 | } | 4071 | } |
3472 | } | 4072 | } |
4073 | impl std::fmt::Display for TypeRef { | ||
4074 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4075 | std::fmt::Display::fmt(self.syntax(), f) | ||
4076 | } | ||
4077 | } | ||
3473 | impl AstNode for TypeRef { | 4078 | impl AstNode for TypeRef { |
3474 | fn can_cast(kind: SyntaxKind) -> bool { | 4079 | fn can_cast(kind: SyntaxKind) -> bool { |
3475 | match kind { | 4080 | match kind { |
@@ -3591,6 +4196,11 @@ impl From<Module> for ModuleItem { | |||
3591 | ModuleItem::Module(node) | 4196 | ModuleItem::Module(node) |
3592 | } | 4197 | } |
3593 | } | 4198 | } |
4199 | impl std::fmt::Display for ModuleItem { | ||
4200 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4201 | std::fmt::Display::fmt(self.syntax(), f) | ||
4202 | } | ||
4203 | } | ||
3594 | impl AstNode for ModuleItem { | 4204 | impl AstNode for ModuleItem { |
3595 | fn can_cast(kind: SyntaxKind) -> bool { | 4205 | fn can_cast(kind: SyntaxKind) -> bool { |
3596 | match kind { | 4206 | match kind { |
@@ -3657,6 +4267,11 @@ impl From<ConstDef> for ImplItem { | |||
3657 | ImplItem::ConstDef(node) | 4267 | ImplItem::ConstDef(node) |
3658 | } | 4268 | } |
3659 | } | 4269 | } |
4270 | impl std::fmt::Display for ImplItem { | ||
4271 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4272 | std::fmt::Display::fmt(self.syntax(), f) | ||
4273 | } | ||
4274 | } | ||
3660 | impl AstNode for ImplItem { | 4275 | impl AstNode for ImplItem { |
3661 | fn can_cast(kind: SyntaxKind) -> bool { | 4276 | fn can_cast(kind: SyntaxKind) -> bool { |
3662 | match kind { | 4277 | match kind { |
@@ -3871,6 +4486,11 @@ impl From<BoxExpr> for Expr { | |||
3871 | Expr::BoxExpr(node) | 4486 | Expr::BoxExpr(node) |
3872 | } | 4487 | } |
3873 | } | 4488 | } |
4489 | impl std::fmt::Display for Expr { | ||
4490 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4491 | std::fmt::Display::fmt(self.syntax(), f) | ||
4492 | } | ||
4493 | } | ||
3874 | impl AstNode for Expr { | 4494 | impl AstNode for Expr { |
3875 | fn can_cast(kind: SyntaxKind) -> bool { | 4495 | fn can_cast(kind: SyntaxKind) -> bool { |
3876 | match kind { | 4496 | match kind { |
@@ -4043,6 +4663,11 @@ impl From<LiteralPat> for Pat { | |||
4043 | Pat::LiteralPat(node) | 4663 | Pat::LiteralPat(node) |
4044 | } | 4664 | } |
4045 | } | 4665 | } |
4666 | impl std::fmt::Display for Pat { | ||
4667 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4668 | std::fmt::Display::fmt(self.syntax(), f) | ||
4669 | } | ||
4670 | } | ||
4046 | impl AstNode for Pat { | 4671 | impl AstNode for Pat { |
4047 | fn can_cast(kind: SyntaxKind) -> bool { | 4672 | fn can_cast(kind: SyntaxKind) -> bool { |
4048 | match kind { | 4673 | match kind { |
@@ -4106,6 +4731,11 @@ impl From<TokenTree> for AttrInput { | |||
4106 | AttrInput::TokenTree(node) | 4731 | AttrInput::TokenTree(node) |
4107 | } | 4732 | } |
4108 | } | 4733 | } |
4734 | impl std::fmt::Display for AttrInput { | ||
4735 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4736 | std::fmt::Display::fmt(self.syntax(), f) | ||
4737 | } | ||
4738 | } | ||
4109 | impl AstNode for AttrInput { | 4739 | impl AstNode for AttrInput { |
4110 | fn can_cast(kind: SyntaxKind) -> bool { | 4740 | fn can_cast(kind: SyntaxKind) -> bool { |
4111 | match kind { | 4741 | match kind { |
@@ -4143,6 +4773,11 @@ impl From<LetStmt> for Stmt { | |||
4143 | Stmt::LetStmt(node) | 4773 | Stmt::LetStmt(node) |
4144 | } | 4774 | } |
4145 | } | 4775 | } |
4776 | impl std::fmt::Display for Stmt { | ||
4777 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4778 | std::fmt::Display::fmt(self.syntax(), f) | ||
4779 | } | ||
4780 | } | ||
4146 | impl AstNode for Stmt { | 4781 | impl AstNode for Stmt { |
4147 | fn can_cast(kind: SyntaxKind) -> bool { | 4782 | fn can_cast(kind: SyntaxKind) -> bool { |
4148 | match kind { | 4783 | match kind { |
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index f2684c852..d1baaa607 100644 --- a/crates/ra_syntax/src/parsing/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
@@ -65,7 +65,7 @@ pub fn tokenize(text: &str) -> (Vec<Token>, Vec<SyntaxError>) { | |||
65 | /// Beware that unescape errors are not checked at tokenization time. | 65 | /// Beware that unescape errors are not checked at tokenization time. |
66 | pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxError>)> { | 66 | pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxError>)> { |
67 | lex_first_token(text) | 67 | lex_first_token(text) |
68 | .filter(|(token, _)| token.len.to_usize() == text.len()) | 68 | .filter(|(token, _)| token.len == TextUnit::of_str(text)) |
69 | .map(|(token, error)| (token.kind, error)) | 69 | .map(|(token, error)| (token.kind, error)) |
70 | } | 70 | } |
71 | 71 | ||
@@ -75,7 +75,7 @@ pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxEr | |||
75 | /// Beware that unescape errors are not checked at tokenization time. | 75 | /// Beware that unescape errors are not checked at tokenization time. |
76 | pub fn lex_single_valid_syntax_kind(text: &str) -> Option<SyntaxKind> { | 76 | pub fn lex_single_valid_syntax_kind(text: &str) -> Option<SyntaxKind> { |
77 | lex_first_token(text) | 77 | lex_first_token(text) |
78 | .filter(|(token, error)| !error.is_some() && token.len.to_usize() == text.len()) | 78 | .filter(|(token, error)| !error.is_some() && token.len == TextUnit::of_str(text)) |
79 | .map(|(token, _error)| token.kind) | 79 | .map(|(token, _error)| token.kind) |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/crates/ra_syntax/src/tests.rs b/crates/ra_syntax/src/tests.rs index 912e6aec0..d331d541e 100644 --- a/crates/ra_syntax/src/tests.rs +++ b/crates/ra_syntax/src/tests.rs | |||
@@ -5,7 +5,7 @@ use std::{ | |||
5 | 5 | ||
6 | use test_utils::{collect_tests, dir_tests, project_dir, read_text}; | 6 | use test_utils::{collect_tests, dir_tests, project_dir, read_text}; |
7 | 7 | ||
8 | use crate::{fuzz, tokenize, SourceFile, SyntaxError, Token}; | 8 | use crate::{fuzz, tokenize, SourceFile, SyntaxError, TextRange, TextUnit, Token}; |
9 | 9 | ||
10 | #[test] | 10 | #[test] |
11 | fn lexer_tests() { | 11 | fn lexer_tests() { |
@@ -120,11 +120,11 @@ fn assert_errors_are_absent(errors: &[SyntaxError], path: &Path) { | |||
120 | 120 | ||
121 | fn dump_tokens_and_errors(tokens: &[Token], errors: &[SyntaxError], text: &str) -> String { | 121 | fn dump_tokens_and_errors(tokens: &[Token], errors: &[SyntaxError], text: &str) -> String { |
122 | let mut acc = String::new(); | 122 | let mut acc = String::new(); |
123 | let mut offset = 0; | 123 | let mut offset = TextUnit::from_usize(0); |
124 | for token in tokens { | 124 | for token in tokens { |
125 | let token_len = token.len.to_usize(); | 125 | let token_len = token.len; |
126 | let token_text = &text[offset..offset + token_len]; | 126 | let token_text = &text[TextRange::offset_len(offset, token.len)]; |
127 | offset += token_len; | 127 | offset += token.len; |
128 | writeln!(acc, "{:?} {} {:?}", token.kind, token_len, token_text).unwrap(); | 128 | writeln!(acc, "{:?} {} {:?}", token.kind, token_len, token_text).unwrap(); |
129 | } | 129 | } |
130 | for err in errors { | 130 | for err in errors { |