]> git.lizzy.rs Git - rust.git/commitdiff
clippy: make generated code nice to read
authorKartavya Vashishtha <sendtokartavya@gmail.com>
Sun, 7 Aug 2022 11:39:36 +0000 (17:09 +0530)
committerKartavya Vashishtha <sendtokartavya@gmail.com>
Sun, 7 Aug 2022 11:39:36 +0000 (17:09 +0530)
Feel free to close if this is too minor.

crates/syntax/src/tests/sourcegen_ast.rs

index 6d2766225103f7b0aa2406a99939031a973b7274..daad939f82e0a3c6aebc107468d8524ad9cb9028 100644 (file)
@@ -410,24 +410,17 @@ pub enum SyntaxKind {
 
         impl SyntaxKind {
             pub fn is_keyword(self) -> bool {
-                match self {
-                    #(#all_keywords)|* => true,
-                    _ => false,
-                }
+                matches!(self, #(#all_keywords)|*)
             }
 
             pub fn is_punct(self) -> bool {
-                match self {
-                    #(#punctuation)|* => true,
-                    _ => false,
-                }
+
+                matches!(self, #(#punctuation)|*)
+
             }
 
             pub fn is_literal(self) -> bool {
-                match self {
-                    #(#literals)|* => true,
-                    _ => false,
-                }
+                matches!(self, #(#literals)|*)
             }
 
             pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {