Avoid ref when using format! in compiler
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
This commit is contained in:
parent
0cd01aac6a
commit
aef0e346de
23 changed files with 61 additions and 65 deletions
|
@ -253,7 +253,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
|
|||
|
||||
for Attribute { id: Identifier { name: attr_name }, .. } in attributes {
|
||||
let snake_name = Ident::new(
|
||||
&format!("{}{}", &crate_prefix, &attr_name.replace('-', "_")),
|
||||
&format!("{crate_prefix}{}", attr_name.replace('-', "_")),
|
||||
resource_str.span(),
|
||||
);
|
||||
if !previous_attrs.insert(snake_name.clone()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue