mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
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
9fd6c695da
commit
cc1aded86c
8 changed files with 13 additions and 13 deletions
|
@ -179,18 +179,18 @@ pub fn ty_alias(
|
|||
}
|
||||
|
||||
if let Some(list) = type_param_bounds {
|
||||
s.push_str(&format!(" : {}", &list));
|
||||
s.push_str(&format!(" : {list}"));
|
||||
}
|
||||
|
||||
if let Some(cl) = where_clause {
|
||||
s.push_str(&format!(" {}", &cl.to_string()));
|
||||
s.push_str(&format!(" {cl}"));
|
||||
}
|
||||
|
||||
if let Some(exp) = assignment {
|
||||
if let Some(cl) = exp.1 {
|
||||
s.push_str(&format!(" = {} {}", &exp.0.to_string(), &cl.to_string()));
|
||||
s.push_str(&format!(" = {} {cl}", exp.0));
|
||||
} else {
|
||||
s.push_str(&format!(" = {}", &exp.0.to_string()));
|
||||
s.push_str(&format!(" = {}", exp.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue