mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
parent
b3ef934ccb
commit
25242fe93f
395 changed files with 14569 additions and 5755 deletions
|
@ -65,12 +65,12 @@ pub(crate) const KINDS_SRC: KindsSrc<'_> = KindsSrc {
|
|||
(">>=", "SHREQ"),
|
||||
],
|
||||
keywords: &[
|
||||
"as", "async", "await", "box", "break", "const", "continue", "crate", "dyn", "else",
|
||||
"as", "async", "await", "box", "break", "const", "continue", "crate", "do", "dyn", "else",
|
||||
"enum", "extern", "false", "fn", "for", "if", "impl", "in", "let", "loop", "macro",
|
||||
"match", "mod", "move", "mut", "pub", "ref", "return", "self", "Self", "static", "struct",
|
||||
"super", "trait", "true", "try", "type", "unsafe", "use", "where", "while", "yield",
|
||||
],
|
||||
contextual_keywords: &["auto", "default", "existential", "union", "raw", "macro_rules"],
|
||||
contextual_keywords: &["auto", "default", "existential", "union", "raw", "macro_rules", "yeet"],
|
||||
literals: &["INT_NUMBER", "FLOAT_NUMBER", "CHAR", "BYTE", "STRING", "BYTE_STRING"],
|
||||
tokens: &["ERROR", "IDENT", "WHITESPACE", "LIFETIME_IDENT", "COMMENT", "SHEBANG"],
|
||||
nodes: &[
|
||||
|
@ -142,6 +142,7 @@ pub(crate) const KINDS_SRC: KindsSrc<'_> = KindsSrc {
|
|||
"STMT_LIST",
|
||||
"RETURN_EXPR",
|
||||
"YIELD_EXPR",
|
||||
"YEET_EXPR",
|
||||
"LET_EXPR",
|
||||
"UNDERSCORE_EXPR",
|
||||
"MACRO_EXPR",
|
||||
|
|
|
@ -253,7 +253,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String {
|
|||
matches!(kind, #(#kinds)|*)
|
||||
}
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
Self::can_cast(syntax.kind()).then(|| #name { syntax })
|
||||
Self::can_cast(syntax.kind()).then_some(#name { syntax })
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode {
|
||||
&self.syntax
|
||||
|
@ -328,7 +328,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String {
|
|||
|
||||
fn write_doc_comment(contents: &[String], dest: &mut String) {
|
||||
for line in contents {
|
||||
writeln!(dest, "///{}", line).unwrap();
|
||||
writeln!(dest, "///{line}").unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ fn to_pascal_case(s: &str) -> String {
|
|||
}
|
||||
|
||||
fn pluralize(s: &str) -> String {
|
||||
format!("{}s", s)
|
||||
format!("{s}s")
|
||||
}
|
||||
|
||||
impl Field {
|
||||
|
@ -637,7 +637,7 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
|
|||
let mut name = grammar[*token].name.clone();
|
||||
if name != "int_number" && name != "string" {
|
||||
if "[]{}()".contains(&name) {
|
||||
name = format!("'{}'", name);
|
||||
name = format!("'{name}'");
|
||||
}
|
||||
let field = Field::Token(name);
|
||||
acc.push(field);
|
||||
|
@ -651,7 +651,7 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
|
|||
acc.push(field);
|
||||
return;
|
||||
}
|
||||
panic!("unhandled rule: {:?}", rule)
|
||||
panic!("unhandled rule: {rule:?}")
|
||||
}
|
||||
Rule::Labeled { label: l, rule } => {
|
||||
assert!(label.is_none());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue