Skip to content

Commit a3fc4db

Browse files
committed
more matches! sites
1 parent 7025502 commit a3fc4db

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

crates/syntax/src/tests/sourcegen_ast.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String {
169169
quote! {
170170
impl AstNode for #name {
171171
fn can_cast(kind: SyntaxKind) -> bool {
172-
match kind {
173-
#(#kinds)|* => true,
174-
_ => false,
175-
}
172+
matches!(kind, #(#kinds)|*)
176173
}
177174
fn cast(syntax: SyntaxNode) -> Option<Self> {
178175
let res = match syntax.kind() {
@@ -253,10 +250,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String {
253250
}
254251
impl AstNode for #name {
255252
fn can_cast(kind: SyntaxKind) -> bool {
256-
match kind {
257-
#(#kinds)|* => true,
258-
_ => false,
259-
}
253+
matches!(kind, #(#kinds)|*)
260254
}
261255
fn cast(syntax: SyntaxNode) -> Option<Self> {
262256
Self::can_cast(syntax.kind()).then(|| #name { syntax })

0 commit comments

Comments
 (0)