mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Simplify
This commit is contained in:
parent
6d6e0b8f21
commit
b36f12dba5
4 changed files with 112 additions and 184 deletions
|
@ -250,13 +250,11 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String {
|
|||
}
|
||||
}
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
let res = match syntax.kind() {
|
||||
#(
|
||||
#kinds => #name { syntax },
|
||||
)*
|
||||
_ => return None,
|
||||
};
|
||||
Some(res)
|
||||
match syntax.kind() {
|
||||
#(#kinds)|* => Some(#name { syntax }),
|
||||
_ => None,
|
||||
}
|
||||
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode {
|
||||
&self.syntax
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue