More compact
This commit is contained in:
parent
6fd2a12495
commit
9285cbffb6
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -75,12 +75,7 @@ fn generate_tokens(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> {
|
||||
}
|
||||
|
||||
impl AstToken for #name {
|
||||
fn can_cast(kind: SyntaxKind) -> bool {
|
||||
match kind {
|
||||
#kind => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == #kind }
|
||||
fn cast(syntax: SyntaxToken) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
}
|
||||
@ -243,10 +238,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> {
|
||||
|
||||
impl AstNode for #name {
|
||||
fn can_cast(kind: SyntaxKind) -> bool {
|
||||
match kind {
|
||||
#kind => true,
|
||||
_ => false,
|
||||
}
|
||||
kind == #kind
|
||||
}
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None }
|
||||
|
Loading…
x
Reference in New Issue
Block a user