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
|
@ -112,7 +112,7 @@ pub fn report_unstable(
|
|||
) {
|
||||
let msg = match reason {
|
||||
Some(r) => format!("use of unstable library feature '{feature}': {r}"),
|
||||
None => format!("use of unstable library feature '{}'", &feature),
|
||||
None => format!("use of unstable library feature '{feature}'"),
|
||||
};
|
||||
|
||||
if is_soft {
|
||||
|
|
|
@ -2627,7 +2627,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
|
|||
self.prepare_region_info(value);
|
||||
}
|
||||
|
||||
debug!("self.used_region_names: {:?}", &self.used_region_names);
|
||||
debug!("self.used_region_names: {:?}", self.used_region_names);
|
||||
|
||||
let mut empty = true;
|
||||
let mut start_or_continue = |cx: &mut Self, start: &str, cont: &str| {
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn find_self_call<'tcx>(
|
|||
local: Local,
|
||||
block: BasicBlock,
|
||||
) -> Option<(DefId, GenericArgsRef<'tcx>)> {
|
||||
debug!("find_self_call(local={:?}): terminator={:?}", local, &body[block].terminator);
|
||||
debug!("find_self_call(local={:?}): terminator={:?}", local, body[block].terminator);
|
||||
if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) =
|
||||
&body[block].terminator
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue