Skip to content

Commit c1c13bd

Browse files
committed
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.
1 parent 25dce8f commit c1c13bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/abi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
505505
let nop_inst = fx.bcx.ins().nop();
506506
fx.add_comment(
507507
nop_inst,
508-
format!("virtual call; self arg pass mode: {:?}", &fn_abi.args[0]),
508+
format!("virtual call; self arg pass mode: {:?}", fn_abi.args[0]),
509509
);
510510
}
511511

0 commit comments

Comments
 (0)