From 629e8d1ed0aeabf27a1e1b1d3c8c9134716043e3 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Thu, 3 Jun 2021 12:46:56 +0200 Subject: Apply more clippy suggestions and update generated --- crates/parser/src/syntax_kind/generated.rs | 129 +++++------------------------ 1 file changed, 23 insertions(+), 106 deletions(-) (limited to 'crates/parser') diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs index be2dfbbea..bcefd183a 100644 --- a/crates/parser/src/syntax_kind/generated.rs +++ b/crates/parser/src/syntax_kind/generated.rs @@ -260,116 +260,33 @@ pub enum SyntaxKind { use self::SyntaxKind::*; impl SyntaxKind { pub fn is_keyword(self) -> bool { - matches!( - self, - AS_KW - | ASYNC_KW - | AWAIT_KW - | BOX_KW - | BREAK_KW - | CONST_KW - | CONTINUE_KW - | CRATE_KW - | DYN_KW - | ELSE_KW - | ENUM_KW - | EXTERN_KW - | FALSE_KW - | FN_KW - | FOR_KW - | IF_KW - | IMPL_KW - | IN_KW - | LET_KW - | LOOP_KW - | MACRO_KW - | MATCH_KW - | MOD_KW - | MOVE_KW - | MUT_KW - | PUB_KW - | REF_KW - | RETURN_KW - | SELF_KW - | STATIC_KW - | STRUCT_KW - | SUPER_KW - | TRAIT_KW - | TRUE_KW - | TRY_KW - | TYPE_KW - | UNSAFE_KW - | USE_KW - | WHERE_KW - | WHILE_KW - | YIELD_KW - | AUTO_KW - | DEFAULT_KW - | EXISTENTIAL_KW - | UNION_KW - | RAW_KW - | MACRO_RULES_KW - ) + match self { + AS_KW | ASYNC_KW | AWAIT_KW | BOX_KW | BREAK_KW | CONST_KW | CONTINUE_KW | CRATE_KW + | DYN_KW | ELSE_KW | ENUM_KW | EXTERN_KW | FALSE_KW | FN_KW | FOR_KW | IF_KW + | IMPL_KW | IN_KW | LET_KW | LOOP_KW | MACRO_KW | MATCH_KW | MOD_KW | MOVE_KW + | MUT_KW | PUB_KW | REF_KW | RETURN_KW | SELF_KW | STATIC_KW | STRUCT_KW | SUPER_KW + | TRAIT_KW | TRUE_KW | TRY_KW | TYPE_KW | UNSAFE_KW | USE_KW | WHERE_KW | WHILE_KW + | YIELD_KW | AUTO_KW | DEFAULT_KW | EXISTENTIAL_KW | UNION_KW | RAW_KW + | MACRO_RULES_KW => true, + _ => false, + } } pub fn is_punct(self) -> bool { - matches!( - self, - SEMICOLON - | COMMA - | L_PAREN - | R_PAREN - | L_CURLY - | R_CURLY - | L_BRACK - | R_BRACK - | L_ANGLE - | R_ANGLE - | AT - | POUND - | TILDE - | QUESTION - | DOLLAR - | AMP - | PIPE - | PLUS - | STAR - | SLASH - | CARET - | PERCENT - | UNDERSCORE - | DOT - | DOT2 - | DOT3 - | DOT2EQ - | COLON - | COLON2 - | EQ - | EQ2 - | FAT_ARROW - | BANG - | NEQ - | MINUS - | THIN_ARROW - | LTEQ - | GTEQ - | PLUSEQ - | MINUSEQ - | PIPEEQ - | AMPEQ - | CARETEQ - | SLASHEQ - | STAREQ - | PERCENTEQ - | AMP2 - | PIPE2 - | SHL - | SHR - | SHLEQ - | SHREQ - ) + match self { + SEMICOLON | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK + | L_ANGLE | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS + | STAR | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOT2 | DOT3 | DOT2EQ | COLON + | COLON2 | EQ | EQ2 | FAT_ARROW | BANG | NEQ | MINUS | THIN_ARROW | LTEQ | GTEQ + | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | PERCENTEQ | AMP2 + | PIPE2 | SHL | SHR | SHLEQ | SHREQ => true, + _ => false, + } } pub fn is_literal(self) -> bool { - matches!(self, INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | BYTE_STRING) + match self { + INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | BYTE_STRING => true, + _ => false, + } } pub fn from_keyword(ident: &str) -> Option { let kw = match ident { -- cgit v1.2.3