diff options
author | Aleksey Kladov <[email protected]> | 2020-07-31 18:49:26 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-31 18:49:26 +0100 |
commit | 572f1c08b6ba43bdd57c5cb99f79a08ecd821c1c (patch) | |
tree | 5c4677b6e1d3e73424046283c79ebb0d8b175691 /crates/ra_syntax/src/ast/generated | |
parent | 5cade89d730b025082ff2df70aace259951a9ccf (diff) |
Minor gramamr reorder
Diffstat (limited to 'crates/ra_syntax/src/ast/generated')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 651 |
1 files changed, 324 insertions, 327 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 6ce9c4adc..66821a31c 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -6,6 +6,20 @@ use crate::{ | |||
6 | SyntaxNode, SyntaxToken, T, | 6 | SyntaxNode, SyntaxToken, T, |
7 | }; | 7 | }; |
8 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
9 | pub struct Name { | ||
10 | pub(crate) syntax: SyntaxNode, | ||
11 | } | ||
12 | impl Name { | ||
13 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
14 | } | ||
15 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
16 | pub struct NameRef { | ||
17 | pub(crate) syntax: SyntaxNode, | ||
18 | } | ||
19 | impl NameRef { | ||
20 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
21 | } | ||
22 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9 | pub struct Path { | 23 | pub struct Path { |
10 | pub(crate) syntax: SyntaxNode, | 24 | pub(crate) syntax: SyntaxNode, |
11 | } | 25 | } |
@@ -33,13 +47,6 @@ impl PathSegment { | |||
33 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | 47 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
34 | } | 48 | } |
35 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 49 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
36 | pub struct NameRef { | ||
37 | pub(crate) syntax: SyntaxNode, | ||
38 | } | ||
39 | impl NameRef { | ||
40 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
41 | } | ||
42 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
43 | pub struct GenericArgList { | 50 | pub struct GenericArgList { |
44 | pub(crate) syntax: SyntaxNode, | 51 | pub(crate) syntax: SyntaxNode, |
45 | } | 52 | } |
@@ -116,13 +123,16 @@ impl TypeBoundList { | |||
116 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | 123 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } |
117 | } | 124 | } |
118 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 125 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
119 | pub struct SourceFile { | 126 | pub struct MacroCall { |
120 | pub(crate) syntax: SyntaxNode, | 127 | pub(crate) syntax: SyntaxNode, |
121 | } | 128 | } |
122 | impl ast::AttrsOwner for SourceFile {} | 129 | impl ast::AttrsOwner for MacroCall {} |
123 | impl ast::ModuleItemOwner for SourceFile {} | 130 | impl ast::NameOwner for MacroCall {} |
124 | impl SourceFile { | 131 | impl MacroCall { |
125 | pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } | 132 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
133 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
134 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
135 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
126 | } | 136 | } |
127 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 137 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
128 | pub struct Attr { | 138 | pub struct Attr { |
@@ -139,6 +149,41 @@ impl Attr { | |||
139 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 149 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
140 | } | 150 | } |
141 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 151 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
152 | pub struct TokenTree { | ||
153 | pub(crate) syntax: SyntaxNode, | ||
154 | } | ||
155 | impl TokenTree { | ||
156 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
157 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
158 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
159 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
160 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
161 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
162 | } | ||
163 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
164 | pub struct MacroItems { | ||
165 | pub(crate) syntax: SyntaxNode, | ||
166 | } | ||
167 | impl ast::ModuleItemOwner for MacroItems {} | ||
168 | impl MacroItems {} | ||
169 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
170 | pub struct MacroStmts { | ||
171 | pub(crate) syntax: SyntaxNode, | ||
172 | } | ||
173 | impl MacroStmts { | ||
174 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
175 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
176 | } | ||
177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
178 | pub struct SourceFile { | ||
179 | pub(crate) syntax: SyntaxNode, | ||
180 | } | ||
181 | impl ast::AttrsOwner for SourceFile {} | ||
182 | impl ast::ModuleItemOwner for SourceFile {} | ||
183 | impl SourceFile { | ||
184 | pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } | ||
185 | } | ||
186 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
142 | pub struct Const { | 187 | pub struct Const { |
143 | pub(crate) syntax: SyntaxNode, | 188 | pub(crate) syntax: SyntaxNode, |
144 | } | 189 | } |
@@ -228,18 +273,6 @@ impl Impl { | |||
228 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } | 273 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } |
229 | } | 274 | } |
230 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 275 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
231 | pub struct MacroCall { | ||
232 | pub(crate) syntax: SyntaxNode, | ||
233 | } | ||
234 | impl ast::AttrsOwner for MacroCall {} | ||
235 | impl ast::NameOwner for MacroCall {} | ||
236 | impl MacroCall { | ||
237 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
238 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
239 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
240 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
241 | } | ||
242 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
243 | pub struct Module { | 276 | pub struct Module { |
244 | pub(crate) syntax: SyntaxNode, | 277 | pub(crate) syntax: SyntaxNode, |
245 | } | 278 | } |
@@ -349,13 +382,6 @@ impl Visibility { | |||
349 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 382 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
350 | } | 383 | } |
351 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 384 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
352 | pub struct Name { | ||
353 | pub(crate) syntax: SyntaxNode, | ||
354 | } | ||
355 | impl Name { | ||
356 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
357 | } | ||
358 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
359 | pub struct ItemList { | 385 | pub struct ItemList { |
360 | pub(crate) syntax: SyntaxNode, | 386 | pub(crate) syntax: SyntaxNode, |
361 | } | 387 | } |
@@ -589,18 +615,6 @@ pub struct Literal { | |||
589 | impl ast::AttrsOwner for Literal {} | 615 | impl ast::AttrsOwner for Literal {} |
590 | impl Literal {} | 616 | impl Literal {} |
591 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 617 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
592 | pub struct TokenTree { | ||
593 | pub(crate) syntax: SyntaxNode, | ||
594 | } | ||
595 | impl TokenTree { | ||
596 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
597 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
598 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
599 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
600 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
601 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
602 | } | ||
603 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
604 | pub struct ExprStmt { | 618 | pub struct ExprStmt { |
605 | pub(crate) syntax: SyntaxNode, | 619 | pub(crate) syntax: SyntaxNode, |
606 | } | 620 | } |
@@ -1097,28 +1111,15 @@ impl TypeBound { | |||
1097 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 1111 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
1098 | } | 1112 | } |
1099 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1113 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1100 | pub struct OrPat { | 1114 | pub struct BindPat { |
1101 | pub(crate) syntax: SyntaxNode, | ||
1102 | } | ||
1103 | impl OrPat { | ||
1104 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1105 | } | ||
1106 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1107 | pub struct ParenPat { | ||
1108 | pub(crate) syntax: SyntaxNode, | ||
1109 | } | ||
1110 | impl ParenPat { | ||
1111 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1112 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1113 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1114 | } | ||
1115 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1116 | pub struct RefPat { | ||
1117 | pub(crate) syntax: SyntaxNode, | 1115 | pub(crate) syntax: SyntaxNode, |
1118 | } | 1116 | } |
1119 | impl RefPat { | 1117 | impl ast::AttrsOwner for BindPat {} |
1120 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 1118 | impl ast::NameOwner for BindPat {} |
1119 | impl BindPat { | ||
1120 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } | ||
1121 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 1121 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1122 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } | ||
1122 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1123 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1123 | } | 1124 | } |
1124 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1125 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -1130,69 +1131,61 @@ impl BoxPat { | |||
1130 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1131 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1131 | } | 1132 | } |
1132 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1133 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1133 | pub struct BindPat { | 1134 | pub struct DotDotPat { |
1134 | pub(crate) syntax: SyntaxNode, | 1135 | pub(crate) syntax: SyntaxNode, |
1135 | } | 1136 | } |
1136 | impl ast::AttrsOwner for BindPat {} | 1137 | impl DotDotPat { |
1137 | impl ast::NameOwner for BindPat {} | 1138 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1138 | impl BindPat { | ||
1139 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } | ||
1140 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1141 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } | ||
1142 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1143 | } | 1139 | } |
1144 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1140 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1145 | pub struct PlaceholderPat { | 1141 | pub struct LiteralPat { |
1146 | pub(crate) syntax: SyntaxNode, | 1142 | pub(crate) syntax: SyntaxNode, |
1147 | } | 1143 | } |
1148 | impl PlaceholderPat { | 1144 | impl LiteralPat { |
1149 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 1145 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } |
1150 | } | 1146 | } |
1151 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1147 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1152 | pub struct DotDotPat { | 1148 | pub struct MacroPat { |
1153 | pub(crate) syntax: SyntaxNode, | 1149 | pub(crate) syntax: SyntaxNode, |
1154 | } | 1150 | } |
1155 | impl DotDotPat { | 1151 | impl MacroPat { |
1156 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 1152 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } |
1157 | } | 1153 | } |
1158 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1154 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1159 | pub struct PathPat { | 1155 | pub struct OrPat { |
1160 | pub(crate) syntax: SyntaxNode, | 1156 | pub(crate) syntax: SyntaxNode, |
1161 | } | 1157 | } |
1162 | impl PathPat { | 1158 | impl OrPat { |
1163 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1159 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1164 | } | 1160 | } |
1165 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1161 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1166 | pub struct SlicePat { | 1162 | pub struct ParenPat { |
1167 | pub(crate) syntax: SyntaxNode, | 1163 | pub(crate) syntax: SyntaxNode, |
1168 | } | 1164 | } |
1169 | impl SlicePat { | 1165 | impl ParenPat { |
1170 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 1166 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1171 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1167 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1172 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 1168 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1173 | } | 1169 | } |
1174 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1170 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1175 | pub struct RangePat { | 1171 | pub struct PathPat { |
1176 | pub(crate) syntax: SyntaxNode, | 1172 | pub(crate) syntax: SyntaxNode, |
1177 | } | 1173 | } |
1178 | impl RangePat { | 1174 | impl PathPat { |
1179 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 1175 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1180 | pub fn dotdoteq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..=]) } | ||
1181 | } | 1176 | } |
1182 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1183 | pub struct LiteralPat { | 1178 | pub struct PlaceholderPat { |
1184 | pub(crate) syntax: SyntaxNode, | 1179 | pub(crate) syntax: SyntaxNode, |
1185 | } | 1180 | } |
1186 | impl LiteralPat { | 1181 | impl PlaceholderPat { |
1187 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | 1182 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1188 | } | 1183 | } |
1189 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1184 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1190 | pub struct MacroPat { | 1185 | pub struct RangePat { |
1191 | pub(crate) syntax: SyntaxNode, | 1186 | pub(crate) syntax: SyntaxNode, |
1192 | } | 1187 | } |
1193 | impl MacroPat { | 1188 | impl RangePat {} |
1194 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | ||
1195 | } | ||
1196 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1189 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1197 | pub struct RecordPat { | 1190 | pub struct RecordPat { |
1198 | pub(crate) syntax: SyntaxNode, | 1191 | pub(crate) syntax: SyntaxNode, |
@@ -1204,60 +1197,64 @@ impl RecordPat { | |||
1204 | } | 1197 | } |
1205 | } | 1198 | } |
1206 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1199 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1207 | pub struct RecordFieldPatList { | 1200 | pub struct RefPat { |
1208 | pub(crate) syntax: SyntaxNode, | 1201 | pub(crate) syntax: SyntaxNode, |
1209 | } | 1202 | } |
1210 | impl RecordFieldPatList { | 1203 | impl RefPat { |
1211 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 1204 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1212 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | 1205 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1213 | support::children(&self.syntax) | 1206 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1214 | } | ||
1215 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } | ||
1216 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
1217 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1218 | } | 1207 | } |
1219 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1220 | pub struct RecordFieldPat { | 1209 | pub struct SlicePat { |
1221 | pub(crate) syntax: SyntaxNode, | 1210 | pub(crate) syntax: SyntaxNode, |
1222 | } | 1211 | } |
1223 | impl ast::AttrsOwner for RecordFieldPat {} | 1212 | impl SlicePat { |
1224 | impl RecordFieldPat { | 1213 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1225 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1214 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1226 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 1215 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1227 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1228 | } | 1216 | } |
1229 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1217 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1230 | pub struct TupleStructPat { | 1218 | pub struct TuplePat { |
1231 | pub(crate) syntax: SyntaxNode, | 1219 | pub(crate) syntax: SyntaxNode, |
1232 | } | 1220 | } |
1233 | impl TupleStructPat { | 1221 | impl TuplePat { |
1234 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1235 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 1222 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1236 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1223 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1237 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 1224 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1238 | } | 1225 | } |
1239 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1226 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1240 | pub struct TuplePat { | 1227 | pub struct TupleStructPat { |
1241 | pub(crate) syntax: SyntaxNode, | 1228 | pub(crate) syntax: SyntaxNode, |
1242 | } | 1229 | } |
1243 | impl TuplePat { | 1230 | impl TupleStructPat { |
1231 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1244 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 1232 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1245 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1233 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1246 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 1234 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1247 | } | 1235 | } |
1248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1236 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1249 | pub struct MacroItems { | 1237 | pub struct RecordFieldPatList { |
1250 | pub(crate) syntax: SyntaxNode, | 1238 | pub(crate) syntax: SyntaxNode, |
1251 | } | 1239 | } |
1252 | impl ast::ModuleItemOwner for MacroItems {} | 1240 | impl RecordFieldPatList { |
1253 | impl MacroItems {} | 1241 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1242 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | ||
1243 | support::children(&self.syntax) | ||
1244 | } | ||
1245 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } | ||
1246 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
1247 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1248 | } | ||
1254 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1249 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1255 | pub struct MacroStmts { | 1250 | pub struct RecordFieldPat { |
1256 | pub(crate) syntax: SyntaxNode, | 1251 | pub(crate) syntax: SyntaxNode, |
1257 | } | 1252 | } |
1258 | impl MacroStmts { | 1253 | impl ast::AttrsOwner for RecordFieldPat {} |
1259 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 1254 | impl RecordFieldPat { |
1260 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1255 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1256 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1257 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1261 | } | 1258 | } |
1262 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1259 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1263 | pub enum GenericArg { | 1260 | pub enum GenericArg { |
@@ -1334,22 +1331,28 @@ pub enum Item { | |||
1334 | } | 1331 | } |
1335 | impl ast::AttrsOwner for Item {} | 1332 | impl ast::AttrsOwner for Item {} |
1336 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1333 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1334 | pub enum Stmt { | ||
1335 | ExprStmt(ExprStmt), | ||
1336 | Item(Item), | ||
1337 | LetStmt(LetStmt), | ||
1338 | } | ||
1339 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1337 | pub enum Pat { | 1340 | pub enum Pat { |
1338 | OrPat(OrPat), | ||
1339 | ParenPat(ParenPat), | ||
1340 | RefPat(RefPat), | ||
1341 | BoxPat(BoxPat), | ||
1342 | BindPat(BindPat), | 1341 | BindPat(BindPat), |
1343 | PlaceholderPat(PlaceholderPat), | 1342 | BoxPat(BoxPat), |
1344 | DotDotPat(DotDotPat), | 1343 | DotDotPat(DotDotPat), |
1344 | LiteralPat(LiteralPat), | ||
1345 | MacroPat(MacroPat), | ||
1346 | OrPat(OrPat), | ||
1347 | ParenPat(ParenPat), | ||
1345 | PathPat(PathPat), | 1348 | PathPat(PathPat), |
1349 | PlaceholderPat(PlaceholderPat), | ||
1350 | RangePat(RangePat), | ||
1346 | RecordPat(RecordPat), | 1351 | RecordPat(RecordPat), |
1347 | TupleStructPat(TupleStructPat), | 1352 | RefPat(RefPat), |
1348 | TuplePat(TuplePat), | ||
1349 | SlicePat(SlicePat), | 1353 | SlicePat(SlicePat), |
1350 | RangePat(RangePat), | 1354 | TuplePat(TuplePat), |
1351 | LiteralPat(LiteralPat), | 1355 | TupleStructPat(TupleStructPat), |
1352 | MacroPat(MacroPat), | ||
1353 | } | 1356 | } |
1354 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1357 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1355 | pub enum FieldList { | 1358 | pub enum FieldList { |
@@ -1390,14 +1393,19 @@ pub enum GenericParam { | |||
1390 | TypeParam(TypeParam), | 1393 | TypeParam(TypeParam), |
1391 | } | 1394 | } |
1392 | impl ast::AttrsOwner for GenericParam {} | 1395 | impl ast::AttrsOwner for GenericParam {} |
1393 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1396 | impl AstNode for Name { |
1394 | pub enum Stmt { | 1397 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } |
1395 | ExprStmt(ExprStmt), | 1398 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1396 | Item(Item), | 1399 | if Self::can_cast(syntax.kind()) { |
1397 | LetStmt(LetStmt), | 1400 | Some(Self { syntax }) |
1401 | } else { | ||
1402 | None | ||
1403 | } | ||
1404 | } | ||
1405 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1398 | } | 1406 | } |
1399 | impl AstNode for Path { | 1407 | impl AstNode for NameRef { |
1400 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } | 1408 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } |
1401 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1409 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1402 | if Self::can_cast(syntax.kind()) { | 1410 | if Self::can_cast(syntax.kind()) { |
1403 | Some(Self { syntax }) | 1411 | Some(Self { syntax }) |
@@ -1407,8 +1415,8 @@ impl AstNode for Path { | |||
1407 | } | 1415 | } |
1408 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1416 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1409 | } | 1417 | } |
1410 | impl AstNode for PathSegment { | 1418 | impl AstNode for Path { |
1411 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } | 1419 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } |
1412 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1420 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1413 | if Self::can_cast(syntax.kind()) { | 1421 | if Self::can_cast(syntax.kind()) { |
1414 | Some(Self { syntax }) | 1422 | Some(Self { syntax }) |
@@ -1418,8 +1426,8 @@ impl AstNode for PathSegment { | |||
1418 | } | 1426 | } |
1419 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1427 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1420 | } | 1428 | } |
1421 | impl AstNode for NameRef { | 1429 | impl AstNode for PathSegment { |
1422 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } | 1430 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } |
1423 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1431 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1424 | if Self::can_cast(syntax.kind()) { | 1432 | if Self::can_cast(syntax.kind()) { |
1425 | Some(Self { syntax }) | 1433 | Some(Self { syntax }) |
@@ -1528,8 +1536,8 @@ impl AstNode for TypeBoundList { | |||
1528 | } | 1536 | } |
1529 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1537 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1530 | } | 1538 | } |
1531 | impl AstNode for SourceFile { | 1539 | impl AstNode for MacroCall { |
1532 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } | 1540 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } |
1533 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1541 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1534 | if Self::can_cast(syntax.kind()) { | 1542 | if Self::can_cast(syntax.kind()) { |
1535 | Some(Self { syntax }) | 1543 | Some(Self { syntax }) |
@@ -1550,6 +1558,50 @@ impl AstNode for Attr { | |||
1550 | } | 1558 | } |
1551 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1559 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1552 | } | 1560 | } |
1561 | impl AstNode for TokenTree { | ||
1562 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } | ||
1563 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1564 | if Self::can_cast(syntax.kind()) { | ||
1565 | Some(Self { syntax }) | ||
1566 | } else { | ||
1567 | None | ||
1568 | } | ||
1569 | } | ||
1570 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1571 | } | ||
1572 | impl AstNode for MacroItems { | ||
1573 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } | ||
1574 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1575 | if Self::can_cast(syntax.kind()) { | ||
1576 | Some(Self { syntax }) | ||
1577 | } else { | ||
1578 | None | ||
1579 | } | ||
1580 | } | ||
1581 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1582 | } | ||
1583 | impl AstNode for MacroStmts { | ||
1584 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } | ||
1585 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1586 | if Self::can_cast(syntax.kind()) { | ||
1587 | Some(Self { syntax }) | ||
1588 | } else { | ||
1589 | None | ||
1590 | } | ||
1591 | } | ||
1592 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1593 | } | ||
1594 | impl AstNode for SourceFile { | ||
1595 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } | ||
1596 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1597 | if Self::can_cast(syntax.kind()) { | ||
1598 | Some(Self { syntax }) | ||
1599 | } else { | ||
1600 | None | ||
1601 | } | ||
1602 | } | ||
1603 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1604 | } | ||
1553 | impl AstNode for Const { | 1605 | impl AstNode for Const { |
1554 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } | 1606 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } |
1555 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1607 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1616,17 +1668,6 @@ impl AstNode for Impl { | |||
1616 | } | 1668 | } |
1617 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1669 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1618 | } | 1670 | } |
1619 | impl AstNode for MacroCall { | ||
1620 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } | ||
1621 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1622 | if Self::can_cast(syntax.kind()) { | ||
1623 | Some(Self { syntax }) | ||
1624 | } else { | ||
1625 | None | ||
1626 | } | ||
1627 | } | ||
1628 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1629 | } | ||
1630 | impl AstNode for Module { | 1671 | impl AstNode for Module { |
1631 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } | 1672 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } |
1632 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1673 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1715,17 +1756,6 @@ impl AstNode for Visibility { | |||
1715 | } | 1756 | } |
1716 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1757 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1717 | } | 1758 | } |
1718 | impl AstNode for Name { | ||
1719 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } | ||
1720 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1721 | if Self::can_cast(syntax.kind()) { | ||
1722 | Some(Self { syntax }) | ||
1723 | } else { | ||
1724 | None | ||
1725 | } | ||
1726 | } | ||
1727 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1728 | } | ||
1729 | impl AstNode for ItemList { | 1759 | impl AstNode for ItemList { |
1730 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } | 1760 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } |
1731 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1761 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1979,17 +2009,6 @@ impl AstNode for Literal { | |||
1979 | } | 2009 | } |
1980 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2010 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1981 | } | 2011 | } |
1982 | impl AstNode for TokenTree { | ||
1983 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } | ||
1984 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1985 | if Self::can_cast(syntax.kind()) { | ||
1986 | Some(Self { syntax }) | ||
1987 | } else { | ||
1988 | None | ||
1989 | } | ||
1990 | } | ||
1991 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1992 | } | ||
1993 | impl AstNode for ExprStmt { | 2012 | impl AstNode for ExprStmt { |
1994 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } | 2013 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } |
1995 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2014 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2540,8 +2559,8 @@ impl AstNode for TypeBound { | |||
2540 | } | 2559 | } |
2541 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2560 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2542 | } | 2561 | } |
2543 | impl AstNode for OrPat { | 2562 | impl AstNode for BindPat { |
2544 | fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } | 2563 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } |
2545 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2564 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2546 | if Self::can_cast(syntax.kind()) { | 2565 | if Self::can_cast(syntax.kind()) { |
2547 | Some(Self { syntax }) | 2566 | Some(Self { syntax }) |
@@ -2551,8 +2570,8 @@ impl AstNode for OrPat { | |||
2551 | } | 2570 | } |
2552 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2571 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2553 | } | 2572 | } |
2554 | impl AstNode for ParenPat { | 2573 | impl AstNode for BoxPat { |
2555 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } | 2574 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } |
2556 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2575 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2557 | if Self::can_cast(syntax.kind()) { | 2576 | if Self::can_cast(syntax.kind()) { |
2558 | Some(Self { syntax }) | 2577 | Some(Self { syntax }) |
@@ -2562,8 +2581,8 @@ impl AstNode for ParenPat { | |||
2562 | } | 2581 | } |
2563 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2582 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2564 | } | 2583 | } |
2565 | impl AstNode for RefPat { | 2584 | impl AstNode for DotDotPat { |
2566 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } | 2585 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } |
2567 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2586 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2568 | if Self::can_cast(syntax.kind()) { | 2587 | if Self::can_cast(syntax.kind()) { |
2569 | Some(Self { syntax }) | 2588 | Some(Self { syntax }) |
@@ -2573,8 +2592,8 @@ impl AstNode for RefPat { | |||
2573 | } | 2592 | } |
2574 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2593 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2575 | } | 2594 | } |
2576 | impl AstNode for BoxPat { | 2595 | impl AstNode for LiteralPat { |
2577 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } | 2596 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } |
2578 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2597 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2579 | if Self::can_cast(syntax.kind()) { | 2598 | if Self::can_cast(syntax.kind()) { |
2580 | Some(Self { syntax }) | 2599 | Some(Self { syntax }) |
@@ -2584,8 +2603,8 @@ impl AstNode for BoxPat { | |||
2584 | } | 2603 | } |
2585 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2604 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2586 | } | 2605 | } |
2587 | impl AstNode for BindPat { | 2606 | impl AstNode for MacroPat { |
2588 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } | 2607 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } |
2589 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2608 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2590 | if Self::can_cast(syntax.kind()) { | 2609 | if Self::can_cast(syntax.kind()) { |
2591 | Some(Self { syntax }) | 2610 | Some(Self { syntax }) |
@@ -2595,8 +2614,8 @@ impl AstNode for BindPat { | |||
2595 | } | 2614 | } |
2596 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2615 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2597 | } | 2616 | } |
2598 | impl AstNode for PlaceholderPat { | 2617 | impl AstNode for OrPat { |
2599 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } | 2618 | fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } |
2600 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2619 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2601 | if Self::can_cast(syntax.kind()) { | 2620 | if Self::can_cast(syntax.kind()) { |
2602 | Some(Self { syntax }) | 2621 | Some(Self { syntax }) |
@@ -2606,8 +2625,8 @@ impl AstNode for PlaceholderPat { | |||
2606 | } | 2625 | } |
2607 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2626 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2608 | } | 2627 | } |
2609 | impl AstNode for DotDotPat { | 2628 | impl AstNode for ParenPat { |
2610 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } | 2629 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } |
2611 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2630 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2612 | if Self::can_cast(syntax.kind()) { | 2631 | if Self::can_cast(syntax.kind()) { |
2613 | Some(Self { syntax }) | 2632 | Some(Self { syntax }) |
@@ -2628,8 +2647,8 @@ impl AstNode for PathPat { | |||
2628 | } | 2647 | } |
2629 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2648 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2630 | } | 2649 | } |
2631 | impl AstNode for SlicePat { | 2650 | impl AstNode for PlaceholderPat { |
2632 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } | 2651 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } |
2633 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2652 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2634 | if Self::can_cast(syntax.kind()) { | 2653 | if Self::can_cast(syntax.kind()) { |
2635 | Some(Self { syntax }) | 2654 | Some(Self { syntax }) |
@@ -2650,28 +2669,6 @@ impl AstNode for RangePat { | |||
2650 | } | 2669 | } |
2651 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2670 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2652 | } | 2671 | } |
2653 | impl AstNode for LiteralPat { | ||
2654 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } | ||
2655 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2656 | if Self::can_cast(syntax.kind()) { | ||
2657 | Some(Self { syntax }) | ||
2658 | } else { | ||
2659 | None | ||
2660 | } | ||
2661 | } | ||
2662 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2663 | } | ||
2664 | impl AstNode for MacroPat { | ||
2665 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } | ||
2666 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2667 | if Self::can_cast(syntax.kind()) { | ||
2668 | Some(Self { syntax }) | ||
2669 | } else { | ||
2670 | None | ||
2671 | } | ||
2672 | } | ||
2673 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2674 | } | ||
2675 | impl AstNode for RecordPat { | 2672 | impl AstNode for RecordPat { |
2676 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } | 2673 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } |
2677 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2674 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2683,8 +2680,8 @@ impl AstNode for RecordPat { | |||
2683 | } | 2680 | } |
2684 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2681 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2685 | } | 2682 | } |
2686 | impl AstNode for RecordFieldPatList { | 2683 | impl AstNode for RefPat { |
2687 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } | 2684 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } |
2688 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2685 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2689 | if Self::can_cast(syntax.kind()) { | 2686 | if Self::can_cast(syntax.kind()) { |
2690 | Some(Self { syntax }) | 2687 | Some(Self { syntax }) |
@@ -2694,8 +2691,8 @@ impl AstNode for RecordFieldPatList { | |||
2694 | } | 2691 | } |
2695 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2692 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2696 | } | 2693 | } |
2697 | impl AstNode for RecordFieldPat { | 2694 | impl AstNode for SlicePat { |
2698 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } | 2695 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } |
2699 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2696 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2700 | if Self::can_cast(syntax.kind()) { | 2697 | if Self::can_cast(syntax.kind()) { |
2701 | Some(Self { syntax }) | 2698 | Some(Self { syntax }) |
@@ -2705,8 +2702,8 @@ impl AstNode for RecordFieldPat { | |||
2705 | } | 2702 | } |
2706 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2703 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2707 | } | 2704 | } |
2708 | impl AstNode for TupleStructPat { | 2705 | impl AstNode for TuplePat { |
2709 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } | 2706 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } |
2710 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2707 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2711 | if Self::can_cast(syntax.kind()) { | 2708 | if Self::can_cast(syntax.kind()) { |
2712 | Some(Self { syntax }) | 2709 | Some(Self { syntax }) |
@@ -2716,8 +2713,8 @@ impl AstNode for TupleStructPat { | |||
2716 | } | 2713 | } |
2717 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2714 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2718 | } | 2715 | } |
2719 | impl AstNode for TuplePat { | 2716 | impl AstNode for TupleStructPat { |
2720 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } | 2717 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } |
2721 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2718 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2722 | if Self::can_cast(syntax.kind()) { | 2719 | if Self::can_cast(syntax.kind()) { |
2723 | Some(Self { syntax }) | 2720 | Some(Self { syntax }) |
@@ -2727,8 +2724,8 @@ impl AstNode for TuplePat { | |||
2727 | } | 2724 | } |
2728 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2725 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2729 | } | 2726 | } |
2730 | impl AstNode for MacroItems { | 2727 | impl AstNode for RecordFieldPatList { |
2731 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } | 2728 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } |
2732 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2729 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2733 | if Self::can_cast(syntax.kind()) { | 2730 | if Self::can_cast(syntax.kind()) { |
2734 | Some(Self { syntax }) | 2731 | Some(Self { syntax }) |
@@ -2738,8 +2735,8 @@ impl AstNode for MacroItems { | |||
2738 | } | 2735 | } |
2739 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2736 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2740 | } | 2737 | } |
2741 | impl AstNode for MacroStmts { | 2738 | impl AstNode for RecordFieldPat { |
2742 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } | 2739 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } |
2743 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2740 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2744 | if Self::can_cast(syntax.kind()) { | 2741 | if Self::can_cast(syntax.kind()) { |
2745 | Some(Self { syntax }) | 2742 | Some(Self { syntax }) |
@@ -3133,98 +3130,107 @@ impl AstNode for Item { | |||
3133 | } | 3130 | } |
3134 | } | 3131 | } |
3135 | } | 3132 | } |
3136 | impl From<OrPat> for Pat { | 3133 | impl From<ExprStmt> for Stmt { |
3137 | fn from(node: OrPat) -> Pat { Pat::OrPat(node) } | 3134 | fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } |
3138 | } | ||
3139 | impl From<ParenPat> for Pat { | ||
3140 | fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) } | ||
3141 | } | 3135 | } |
3142 | impl From<RefPat> for Pat { | 3136 | impl From<Item> for Stmt { |
3143 | fn from(node: RefPat) -> Pat { Pat::RefPat(node) } | 3137 | fn from(node: Item) -> Stmt { Stmt::Item(node) } |
3144 | } | 3138 | } |
3145 | impl From<BoxPat> for Pat { | 3139 | impl From<LetStmt> for Stmt { |
3146 | fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } | 3140 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } |
3147 | } | 3141 | } |
3148 | impl From<BindPat> for Pat { | 3142 | impl From<BindPat> for Pat { |
3149 | fn from(node: BindPat) -> Pat { Pat::BindPat(node) } | 3143 | fn from(node: BindPat) -> Pat { Pat::BindPat(node) } |
3150 | } | 3144 | } |
3151 | impl From<PlaceholderPat> for Pat { | 3145 | impl From<BoxPat> for Pat { |
3152 | fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } | 3146 | fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } |
3153 | } | 3147 | } |
3154 | impl From<DotDotPat> for Pat { | 3148 | impl From<DotDotPat> for Pat { |
3155 | fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) } | 3149 | fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) } |
3156 | } | 3150 | } |
3151 | impl From<LiteralPat> for Pat { | ||
3152 | fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) } | ||
3153 | } | ||
3154 | impl From<MacroPat> for Pat { | ||
3155 | fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } | ||
3156 | } | ||
3157 | impl From<OrPat> for Pat { | ||
3158 | fn from(node: OrPat) -> Pat { Pat::OrPat(node) } | ||
3159 | } | ||
3160 | impl From<ParenPat> for Pat { | ||
3161 | fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) } | ||
3162 | } | ||
3157 | impl From<PathPat> for Pat { | 3163 | impl From<PathPat> for Pat { |
3158 | fn from(node: PathPat) -> Pat { Pat::PathPat(node) } | 3164 | fn from(node: PathPat) -> Pat { Pat::PathPat(node) } |
3159 | } | 3165 | } |
3166 | impl From<PlaceholderPat> for Pat { | ||
3167 | fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } | ||
3168 | } | ||
3169 | impl From<RangePat> for Pat { | ||
3170 | fn from(node: RangePat) -> Pat { Pat::RangePat(node) } | ||
3171 | } | ||
3160 | impl From<RecordPat> for Pat { | 3172 | impl From<RecordPat> for Pat { |
3161 | fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) } | 3173 | fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) } |
3162 | } | 3174 | } |
3163 | impl From<TupleStructPat> for Pat { | 3175 | impl From<RefPat> for Pat { |
3164 | fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } | 3176 | fn from(node: RefPat) -> Pat { Pat::RefPat(node) } |
3165 | } | ||
3166 | impl From<TuplePat> for Pat { | ||
3167 | fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) } | ||
3168 | } | 3177 | } |
3169 | impl From<SlicePat> for Pat { | 3178 | impl From<SlicePat> for Pat { |
3170 | fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) } | 3179 | fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) } |
3171 | } | 3180 | } |
3172 | impl From<RangePat> for Pat { | 3181 | impl From<TuplePat> for Pat { |
3173 | fn from(node: RangePat) -> Pat { Pat::RangePat(node) } | 3182 | fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) } |
3174 | } | ||
3175 | impl From<LiteralPat> for Pat { | ||
3176 | fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) } | ||
3177 | } | 3183 | } |
3178 | impl From<MacroPat> for Pat { | 3184 | impl From<TupleStructPat> for Pat { |
3179 | fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } | 3185 | fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } |
3180 | } | 3186 | } |
3181 | impl AstNode for Pat { | 3187 | impl AstNode for Pat { |
3182 | fn can_cast(kind: SyntaxKind) -> bool { | 3188 | fn can_cast(kind: SyntaxKind) -> bool { |
3183 | match kind { | 3189 | match kind { |
3184 | OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT | 3190 | BIND_PAT | BOX_PAT | DOT_DOT_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT |
3185 | | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | 3191 | | PATH_PAT | PLACEHOLDER_PAT | RANGE_PAT | RECORD_PAT | REF_PAT | SLICE_PAT |
3186 | | LITERAL_PAT | MACRO_PAT => true, | 3192 | | TUPLE_PAT | TUPLE_STRUCT_PAT => true, |
3187 | _ => false, | 3193 | _ => false, |
3188 | } | 3194 | } |
3189 | } | 3195 | } |
3190 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3196 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3191 | let res = match syntax.kind() { | 3197 | let res = match syntax.kind() { |
3192 | OR_PAT => Pat::OrPat(OrPat { syntax }), | ||
3193 | PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), | ||
3194 | REF_PAT => Pat::RefPat(RefPat { syntax }), | ||
3195 | BOX_PAT => Pat::BoxPat(BoxPat { syntax }), | ||
3196 | BIND_PAT => Pat::BindPat(BindPat { syntax }), | 3198 | BIND_PAT => Pat::BindPat(BindPat { syntax }), |
3197 | PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), | 3199 | BOX_PAT => Pat::BoxPat(BoxPat { syntax }), |
3198 | DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }), | 3200 | DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }), |
3201 | LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), | ||
3202 | MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), | ||
3203 | OR_PAT => Pat::OrPat(OrPat { syntax }), | ||
3204 | PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), | ||
3199 | PATH_PAT => Pat::PathPat(PathPat { syntax }), | 3205 | PATH_PAT => Pat::PathPat(PathPat { syntax }), |
3206 | PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), | ||
3207 | RANGE_PAT => Pat::RangePat(RangePat { syntax }), | ||
3200 | RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), | 3208 | RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), |
3201 | TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), | 3209 | REF_PAT => Pat::RefPat(RefPat { syntax }), |
3202 | TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), | ||
3203 | SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), | 3210 | SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), |
3204 | RANGE_PAT => Pat::RangePat(RangePat { syntax }), | 3211 | TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), |
3205 | LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), | 3212 | TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), |
3206 | MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), | ||
3207 | _ => return None, | 3213 | _ => return None, |
3208 | }; | 3214 | }; |
3209 | Some(res) | 3215 | Some(res) |
3210 | } | 3216 | } |
3211 | fn syntax(&self) -> &SyntaxNode { | 3217 | fn syntax(&self) -> &SyntaxNode { |
3212 | match self { | 3218 | match self { |
3213 | Pat::OrPat(it) => &it.syntax, | ||
3214 | Pat::ParenPat(it) => &it.syntax, | ||
3215 | Pat::RefPat(it) => &it.syntax, | ||
3216 | Pat::BoxPat(it) => &it.syntax, | ||
3217 | Pat::BindPat(it) => &it.syntax, | 3219 | Pat::BindPat(it) => &it.syntax, |
3218 | Pat::PlaceholderPat(it) => &it.syntax, | 3220 | Pat::BoxPat(it) => &it.syntax, |
3219 | Pat::DotDotPat(it) => &it.syntax, | 3221 | Pat::DotDotPat(it) => &it.syntax, |
3222 | Pat::LiteralPat(it) => &it.syntax, | ||
3223 | Pat::MacroPat(it) => &it.syntax, | ||
3224 | Pat::OrPat(it) => &it.syntax, | ||
3225 | Pat::ParenPat(it) => &it.syntax, | ||
3220 | Pat::PathPat(it) => &it.syntax, | 3226 | Pat::PathPat(it) => &it.syntax, |
3227 | Pat::PlaceholderPat(it) => &it.syntax, | ||
3228 | Pat::RangePat(it) => &it.syntax, | ||
3221 | Pat::RecordPat(it) => &it.syntax, | 3229 | Pat::RecordPat(it) => &it.syntax, |
3222 | Pat::TupleStructPat(it) => &it.syntax, | 3230 | Pat::RefPat(it) => &it.syntax, |
3223 | Pat::TuplePat(it) => &it.syntax, | ||
3224 | Pat::SlicePat(it) => &it.syntax, | 3231 | Pat::SlicePat(it) => &it.syntax, |
3225 | Pat::RangePat(it) => &it.syntax, | 3232 | Pat::TuplePat(it) => &it.syntax, |
3226 | Pat::LiteralPat(it) => &it.syntax, | 3233 | Pat::TupleStructPat(it) => &it.syntax, |
3227 | Pat::MacroPat(it) => &it.syntax, | ||
3228 | } | 3234 | } |
3229 | } | 3235 | } |
3230 | } | 3236 | } |
@@ -3393,15 +3399,6 @@ impl AstNode for GenericParam { | |||
3393 | } | 3399 | } |
3394 | } | 3400 | } |
3395 | } | 3401 | } |
3396 | impl From<ExprStmt> for Stmt { | ||
3397 | fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } | ||
3398 | } | ||
3399 | impl From<Item> for Stmt { | ||
3400 | fn from(node: Item) -> Stmt { Stmt::Item(node) } | ||
3401 | } | ||
3402 | impl From<LetStmt> for Stmt { | ||
3403 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } | ||
3404 | } | ||
3405 | impl std::fmt::Display for GenericArg { | 3402 | impl std::fmt::Display for GenericArg { |
3406 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3403 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3407 | std::fmt::Display::fmt(self.syntax(), f) | 3404 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3422,6 +3419,11 @@ impl std::fmt::Display for Item { | |||
3422 | std::fmt::Display::fmt(self.syntax(), f) | 3419 | std::fmt::Display::fmt(self.syntax(), f) |
3423 | } | 3420 | } |
3424 | } | 3421 | } |
3422 | impl std::fmt::Display for Stmt { | ||
3423 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3424 | std::fmt::Display::fmt(self.syntax(), f) | ||
3425 | } | ||
3426 | } | ||
3425 | impl std::fmt::Display for Pat { | 3427 | impl std::fmt::Display for Pat { |
3426 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3428 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3427 | std::fmt::Display::fmt(self.syntax(), f) | 3429 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3452,22 +3454,22 @@ impl std::fmt::Display for GenericParam { | |||
3452 | std::fmt::Display::fmt(self.syntax(), f) | 3454 | std::fmt::Display::fmt(self.syntax(), f) |
3453 | } | 3455 | } |
3454 | } | 3456 | } |
3455 | impl std::fmt::Display for Stmt { | 3457 | impl std::fmt::Display for Name { |
3456 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3458 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3457 | std::fmt::Display::fmt(self.syntax(), f) | 3459 | std::fmt::Display::fmt(self.syntax(), f) |
3458 | } | 3460 | } |
3459 | } | 3461 | } |
3460 | impl std::fmt::Display for Path { | 3462 | impl std::fmt::Display for NameRef { |
3461 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3463 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3462 | std::fmt::Display::fmt(self.syntax(), f) | 3464 | std::fmt::Display::fmt(self.syntax(), f) |
3463 | } | 3465 | } |
3464 | } | 3466 | } |
3465 | impl std::fmt::Display for PathSegment { | 3467 | impl std::fmt::Display for Path { |
3466 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3468 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3467 | std::fmt::Display::fmt(self.syntax(), f) | 3469 | std::fmt::Display::fmt(self.syntax(), f) |
3468 | } | 3470 | } |
3469 | } | 3471 | } |
3470 | impl std::fmt::Display for NameRef { | 3472 | impl std::fmt::Display for PathSegment { |
3471 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3473 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3472 | std::fmt::Display::fmt(self.syntax(), f) | 3474 | std::fmt::Display::fmt(self.syntax(), f) |
3473 | } | 3475 | } |
@@ -3517,7 +3519,7 @@ impl std::fmt::Display for TypeBoundList { | |||
3517 | std::fmt::Display::fmt(self.syntax(), f) | 3519 | std::fmt::Display::fmt(self.syntax(), f) |
3518 | } | 3520 | } |
3519 | } | 3521 | } |
3520 | impl std::fmt::Display for SourceFile { | 3522 | impl std::fmt::Display for MacroCall { |
3521 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3523 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3522 | std::fmt::Display::fmt(self.syntax(), f) | 3524 | std::fmt::Display::fmt(self.syntax(), f) |
3523 | } | 3525 | } |
@@ -3527,6 +3529,26 @@ impl std::fmt::Display for Attr { | |||
3527 | std::fmt::Display::fmt(self.syntax(), f) | 3529 | std::fmt::Display::fmt(self.syntax(), f) |
3528 | } | 3530 | } |
3529 | } | 3531 | } |
3532 | impl std::fmt::Display for TokenTree { | ||
3533 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3534 | std::fmt::Display::fmt(self.syntax(), f) | ||
3535 | } | ||
3536 | } | ||
3537 | impl std::fmt::Display for MacroItems { | ||
3538 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3539 | std::fmt::Display::fmt(self.syntax(), f) | ||
3540 | } | ||
3541 | } | ||
3542 | impl std::fmt::Display for MacroStmts { | ||
3543 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3544 | std::fmt::Display::fmt(self.syntax(), f) | ||
3545 | } | ||
3546 | } | ||
3547 | impl std::fmt::Display for SourceFile { | ||
3548 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3549 | std::fmt::Display::fmt(self.syntax(), f) | ||
3550 | } | ||
3551 | } | ||
3530 | impl std::fmt::Display for Const { | 3552 | impl std::fmt::Display for Const { |
3531 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3553 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3532 | std::fmt::Display::fmt(self.syntax(), f) | 3554 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3557,11 +3579,6 @@ impl std::fmt::Display for Impl { | |||
3557 | std::fmt::Display::fmt(self.syntax(), f) | 3579 | std::fmt::Display::fmt(self.syntax(), f) |
3558 | } | 3580 | } |
3559 | } | 3581 | } |
3560 | impl std::fmt::Display for MacroCall { | ||
3561 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3562 | std::fmt::Display::fmt(self.syntax(), f) | ||
3563 | } | ||
3564 | } | ||
3565 | impl std::fmt::Display for Module { | 3582 | impl std::fmt::Display for Module { |
3566 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3583 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3567 | std::fmt::Display::fmt(self.syntax(), f) | 3584 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3602,11 +3619,6 @@ impl std::fmt::Display for Visibility { | |||
3602 | std::fmt::Display::fmt(self.syntax(), f) | 3619 | std::fmt::Display::fmt(self.syntax(), f) |
3603 | } | 3620 | } |
3604 | } | 3621 | } |
3605 | impl std::fmt::Display for Name { | ||
3606 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3607 | std::fmt::Display::fmt(self.syntax(), f) | ||
3608 | } | ||
3609 | } | ||
3610 | impl std::fmt::Display for ItemList { | 3622 | impl std::fmt::Display for ItemList { |
3611 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3623 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3612 | std::fmt::Display::fmt(self.syntax(), f) | 3624 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3722,11 +3734,6 @@ impl std::fmt::Display for Literal { | |||
3722 | std::fmt::Display::fmt(self.syntax(), f) | 3734 | std::fmt::Display::fmt(self.syntax(), f) |
3723 | } | 3735 | } |
3724 | } | 3736 | } |
3725 | impl std::fmt::Display for TokenTree { | ||
3726 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3727 | std::fmt::Display::fmt(self.syntax(), f) | ||
3728 | } | ||
3729 | } | ||
3730 | impl std::fmt::Display for ExprStmt { | 3737 | impl std::fmt::Display for ExprStmt { |
3731 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3738 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3732 | std::fmt::Display::fmt(self.syntax(), f) | 3739 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3977,37 +3984,37 @@ impl std::fmt::Display for TypeBound { | |||
3977 | std::fmt::Display::fmt(self.syntax(), f) | 3984 | std::fmt::Display::fmt(self.syntax(), f) |
3978 | } | 3985 | } |
3979 | } | 3986 | } |
3980 | impl std::fmt::Display for OrPat { | 3987 | impl std::fmt::Display for BindPat { |
3981 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3988 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3982 | std::fmt::Display::fmt(self.syntax(), f) | 3989 | std::fmt::Display::fmt(self.syntax(), f) |
3983 | } | 3990 | } |
3984 | } | 3991 | } |
3985 | impl std::fmt::Display for ParenPat { | 3992 | impl std::fmt::Display for BoxPat { |
3986 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3993 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3987 | std::fmt::Display::fmt(self.syntax(), f) | 3994 | std::fmt::Display::fmt(self.syntax(), f) |
3988 | } | 3995 | } |
3989 | } | 3996 | } |
3990 | impl std::fmt::Display for RefPat { | 3997 | impl std::fmt::Display for DotDotPat { |
3991 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3998 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3992 | std::fmt::Display::fmt(self.syntax(), f) | 3999 | std::fmt::Display::fmt(self.syntax(), f) |
3993 | } | 4000 | } |
3994 | } | 4001 | } |
3995 | impl std::fmt::Display for BoxPat { | 4002 | impl std::fmt::Display for LiteralPat { |
3996 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4003 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3997 | std::fmt::Display::fmt(self.syntax(), f) | 4004 | std::fmt::Display::fmt(self.syntax(), f) |
3998 | } | 4005 | } |
3999 | } | 4006 | } |
4000 | impl std::fmt::Display for BindPat { | 4007 | impl std::fmt::Display for MacroPat { |
4001 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4008 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4002 | std::fmt::Display::fmt(self.syntax(), f) | 4009 | std::fmt::Display::fmt(self.syntax(), f) |
4003 | } | 4010 | } |
4004 | } | 4011 | } |
4005 | impl std::fmt::Display for PlaceholderPat { | 4012 | impl std::fmt::Display for OrPat { |
4006 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4013 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4007 | std::fmt::Display::fmt(self.syntax(), f) | 4014 | std::fmt::Display::fmt(self.syntax(), f) |
4008 | } | 4015 | } |
4009 | } | 4016 | } |
4010 | impl std::fmt::Display for DotDotPat { | 4017 | impl std::fmt::Display for ParenPat { |
4011 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4018 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4012 | std::fmt::Display::fmt(self.syntax(), f) | 4019 | std::fmt::Display::fmt(self.syntax(), f) |
4013 | } | 4020 | } |
@@ -4017,7 +4024,7 @@ impl std::fmt::Display for PathPat { | |||
4017 | std::fmt::Display::fmt(self.syntax(), f) | 4024 | std::fmt::Display::fmt(self.syntax(), f) |
4018 | } | 4025 | } |
4019 | } | 4026 | } |
4020 | impl std::fmt::Display for SlicePat { | 4027 | impl std::fmt::Display for PlaceholderPat { |
4021 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4028 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4022 | std::fmt::Display::fmt(self.syntax(), f) | 4029 | std::fmt::Display::fmt(self.syntax(), f) |
4023 | } | 4030 | } |
@@ -4027,47 +4034,37 @@ impl std::fmt::Display for RangePat { | |||
4027 | std::fmt::Display::fmt(self.syntax(), f) | 4034 | std::fmt::Display::fmt(self.syntax(), f) |
4028 | } | 4035 | } |
4029 | } | 4036 | } |
4030 | impl std::fmt::Display for LiteralPat { | ||
4031 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4032 | std::fmt::Display::fmt(self.syntax(), f) | ||
4033 | } | ||
4034 | } | ||
4035 | impl std::fmt::Display for MacroPat { | ||
4036 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4037 | std::fmt::Display::fmt(self.syntax(), f) | ||
4038 | } | ||
4039 | } | ||
4040 | impl std::fmt::Display for RecordPat { | 4037 | impl std::fmt::Display for RecordPat { |
4041 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4038 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4042 | std::fmt::Display::fmt(self.syntax(), f) | 4039 | std::fmt::Display::fmt(self.syntax(), f) |
4043 | } | 4040 | } |
4044 | } | 4041 | } |
4045 | impl std::fmt::Display for RecordFieldPatList { | 4042 | impl std::fmt::Display for RefPat { |
4046 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4043 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4047 | std::fmt::Display::fmt(self.syntax(), f) | 4044 | std::fmt::Display::fmt(self.syntax(), f) |
4048 | } | 4045 | } |
4049 | } | 4046 | } |
4050 | impl std::fmt::Display for RecordFieldPat { | 4047 | impl std::fmt::Display for SlicePat { |
4051 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4048 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4052 | std::fmt::Display::fmt(self.syntax(), f) | 4049 | std::fmt::Display::fmt(self.syntax(), f) |
4053 | } | 4050 | } |
4054 | } | 4051 | } |
4055 | impl std::fmt::Display for TupleStructPat { | 4052 | impl std::fmt::Display for TuplePat { |
4056 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4053 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4057 | std::fmt::Display::fmt(self.syntax(), f) | 4054 | std::fmt::Display::fmt(self.syntax(), f) |
4058 | } | 4055 | } |
4059 | } | 4056 | } |
4060 | impl std::fmt::Display for TuplePat { | 4057 | impl std::fmt::Display for TupleStructPat { |
4061 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4058 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4062 | std::fmt::Display::fmt(self.syntax(), f) | 4059 | std::fmt::Display::fmt(self.syntax(), f) |
4063 | } | 4060 | } |
4064 | } | 4061 | } |
4065 | impl std::fmt::Display for MacroItems { | 4062 | impl std::fmt::Display for RecordFieldPatList { |
4066 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4063 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4067 | std::fmt::Display::fmt(self.syntax(), f) | 4064 | std::fmt::Display::fmt(self.syntax(), f) |
4068 | } | 4065 | } |
4069 | } | 4066 | } |
4070 | impl std::fmt::Display for MacroStmts { | 4067 | impl std::fmt::Display for RecordFieldPat { |
4071 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4068 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4072 | std::fmt::Display::fmt(self.syntax(), f) | 4069 | std::fmt::Display::fmt(self.syntax(), f) |
4073 | } | 4070 | } |