aboutsummaryrefslogtreecommitdiff
path: root/crates/parser
diff options
context:
space:
mode:
authorClemens Wasser <[email protected]>2021-06-03 10:45:10 +0100
committerClemens Wasser <[email protected]>2021-06-03 10:46:03 +0100
commit3c6dc0f89dc9c2902d71e8639b4913917a396f8a (patch)
tree6a1acfe280a8e9369a753b4e7bb829b8b9ff6317 /crates/parser
parente8e14e1b13b76aaa643bc3beffb9c52bc5228d24 (diff)
Apply a few clippy suggestions
Diffstat (limited to 'crates/parser')
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs8
-rw-r--r--crates/parser/src/syntax_kind/generated.rs129
2 files changed, 109 insertions, 28 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 269f223e6..abdfca1fe 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -252,12 +252,10 @@ fn closure_expr(p: &mut Parser) -> CompletedMarker {
252 // test lambda_ret_block 252 // test lambda_ret_block
253 // fn main() { || -> i32 { 92 }(); } 253 // fn main() { || -> i32 { 92 }(); }
254 block_expr(p); 254 block_expr(p);
255 } else if p.at_ts(EXPR_FIRST) {
256 expr(p);
255 } else { 257 } else {
256 if p.at_ts(EXPR_FIRST) { 258 p.error("expected expression");
257 expr(p);
258 } else {
259 p.error("expected expression");
260 }
261 } 259 }
262 m.complete(p, CLOSURE_EXPR) 260 m.complete(p, CLOSURE_EXPR)
263} 261}
diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs
index bcefd183a..be2dfbbea 100644
--- a/crates/parser/src/syntax_kind/generated.rs
+++ b/crates/parser/src/syntax_kind/generated.rs
@@ -260,33 +260,116 @@ pub enum SyntaxKind {
260use self::SyntaxKind::*; 260use self::SyntaxKind::*;
261impl SyntaxKind { 261impl SyntaxKind {
262 pub fn is_keyword(self) -> bool { 262 pub fn is_keyword(self) -> bool {
263 match self { 263 matches!(
264 AS_KW | ASYNC_KW | AWAIT_KW | BOX_KW | BREAK_KW | CONST_KW | CONTINUE_KW | CRATE_KW 264 self,
265 | DYN_KW | ELSE_KW | ENUM_KW | EXTERN_KW | FALSE_KW | FN_KW | FOR_KW | IF_KW 265 AS_KW
266 | IMPL_KW | IN_KW | LET_KW | LOOP_KW | MACRO_KW | MATCH_KW | MOD_KW | MOVE_KW 266 | ASYNC_KW
267 | MUT_KW | PUB_KW | REF_KW | RETURN_KW | SELF_KW | STATIC_KW | STRUCT_KW | SUPER_KW 267 | AWAIT_KW
268 | TRAIT_KW | TRUE_KW | TRY_KW | TYPE_KW | UNSAFE_KW | USE_KW | WHERE_KW | WHILE_KW 268 | BOX_KW
269 | YIELD_KW | AUTO_KW | DEFAULT_KW | EXISTENTIAL_KW | UNION_KW | RAW_KW 269 | BREAK_KW
270 | MACRO_RULES_KW => true, 270 | CONST_KW
271 _ => false, 271 | CONTINUE_KW
272 } 272 | CRATE_KW
273 | DYN_KW
274 | ELSE_KW
275 | ENUM_KW
276 | EXTERN_KW
277 | FALSE_KW
278 | FN_KW
279 | FOR_KW
280 | IF_KW
281 | IMPL_KW
282 | IN_KW
283 | LET_KW
284 | LOOP_KW
285 | MACRO_KW
286 | MATCH_KW
287 | MOD_KW
288 | MOVE_KW
289 | MUT_KW
290 | PUB_KW
291 | REF_KW
292 | RETURN_KW
293 | SELF_KW
294 | STATIC_KW
295 | STRUCT_KW
296 | SUPER_KW
297 | TRAIT_KW
298 | TRUE_KW
299 | TRY_KW
300 | TYPE_KW
301 | UNSAFE_KW
302 | USE_KW
303 | WHERE_KW
304 | WHILE_KW
305 | YIELD_KW
306 | AUTO_KW
307 | DEFAULT_KW
308 | EXISTENTIAL_KW
309 | UNION_KW
310 | RAW_KW
311 | MACRO_RULES_KW
312 )
273 } 313 }
274 pub fn is_punct(self) -> bool { 314 pub fn is_punct(self) -> bool {
275 match self { 315 matches!(
276 SEMICOLON | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK 316 self,
277 | L_ANGLE | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS 317 SEMICOLON
278 | STAR | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOT2 | DOT3 | DOT2EQ | COLON 318 | COMMA
279 | COLON2 | EQ | EQ2 | FAT_ARROW | BANG | NEQ | MINUS | THIN_ARROW | LTEQ | GTEQ 319 | L_PAREN
280 | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | PERCENTEQ | AMP2 320 | R_PAREN
281 | PIPE2 | SHL | SHR | SHLEQ | SHREQ => true, 321 | L_CURLY
282 _ => false, 322 | R_CURLY
283 } 323 | L_BRACK
324 | R_BRACK
325 | L_ANGLE
326 | R_ANGLE
327 | AT
328 | POUND
329 | TILDE
330 | QUESTION
331 | DOLLAR
332 | AMP
333 | PIPE
334 | PLUS
335 | STAR
336 | SLASH
337 | CARET
338 | PERCENT
339 | UNDERSCORE
340 | DOT
341 | DOT2
342 | DOT3
343 | DOT2EQ
344 | COLON
345 | COLON2
346 | EQ
347 | EQ2
348 | FAT_ARROW
349 | BANG
350 | NEQ
351 | MINUS
352 | THIN_ARROW
353 | LTEQ
354 | GTEQ
355 | PLUSEQ
356 | MINUSEQ
357 | PIPEEQ
358 | AMPEQ
359 | CARETEQ
360 | SLASHEQ
361 | STAREQ
362 | PERCENTEQ
363 | AMP2
364 | PIPE2
365 | SHL
366 | SHR
367 | SHLEQ
368 | SHREQ
369 )
284 } 370 }
285 pub fn is_literal(self) -> bool { 371 pub fn is_literal(self) -> bool {
286 match self { 372 matches!(self, INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | BYTE_STRING)
287 INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | BYTE_STRING => true,
288 _ => false,
289 }
290 } 373 }
291 pub fn from_keyword(ident: &str) -> Option<SyntaxKind> { 374 pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {
292 let kw = match ident { 375 let kw = match ident {