mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Improve compile time a tiny bit
This commit is contained in:
parent
4271e4c703
commit
c7a079d32d
4 changed files with 13 additions and 10 deletions
|
@ -61,10 +61,13 @@ fn generate_tokens(grammar: &AstSrc) -> Result<String> {
|
|||
}
|
||||
});
|
||||
|
||||
let pretty = reformat(quote! {
|
||||
use crate::{SyntaxKind::{self, *}, SyntaxToken, ast::AstToken};
|
||||
#(#tokens)*
|
||||
})?
|
||||
let pretty = reformat(
|
||||
"e! {
|
||||
use crate::{SyntaxKind::{self, *}, SyntaxToken, ast::AstToken};
|
||||
#(#tokens)*
|
||||
}
|
||||
.to_string(),
|
||||
)?
|
||||
.replace("#[derive", "\n#[derive");
|
||||
Ok(pretty)
|
||||
}
|
||||
|
@ -261,7 +264,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> Result<String> {
|
|||
}
|
||||
}
|
||||
|
||||
let pretty = reformat(res)?;
|
||||
let pretty = reformat(&res)?;
|
||||
Ok(pretty)
|
||||
}
|
||||
|
||||
|
@ -383,7 +386,7 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> Result<String> {
|
|||
}
|
||||
};
|
||||
|
||||
reformat(ast)
|
||||
reformat(&ast.to_string())
|
||||
}
|
||||
|
||||
fn to_upper_snake_case(s: &str) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue