Auto merge of #13130 - nyurik:ref-lints, r=Centri3
Avoid ref when using format!
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.
See also https://github.com/rust-lang/rust/issues/112156
changelog: none
This commit is contained in:
commit
479491ebce
6 changed files with 8 additions and 8 deletions
|
|
@ -151,7 +151,7 @@ fn check_open_options(cx: &LateContext<'_>, settings: &[(OpenOption, Argument, S
|
|||
cx,
|
||||
NONSENSICAL_OPEN_OPTIONS,
|
||||
prev_span,
|
||||
format!("the method `{}` is called more than once", &option),
|
||||
format!("the method `{option}` is called more than once"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ pub(super) fn check<'tcx>(
|
|||
.collect::<Vec<_>>()
|
||||
.join(" and ");
|
||||
|
||||
format!("methods with the following characteristics: ({})", &s)
|
||||
format!("methods with the following characteristics: ({s})")
|
||||
} else {
|
||||
format!("methods called {}", &conventions[0])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue