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:
@@ -904,7 +904,7 @@ impl<Cx: PatCx> Constructor<Cx> {
|
||||
// be careful to detect strings here. However a string literal pattern will never
|
||||
// be reported as a non-exhaustiveness witness, so we can ignore this issue.
|
||||
Ref => {
|
||||
write!(f, "&{:?}", &fields.next().unwrap())?;
|
||||
write!(f, "&{:?}", fields.next().unwrap())?;
|
||||
}
|
||||
Slice(slice) => {
|
||||
write!(f, "[")?;
|
||||
|
||||
Reference in New Issue
Block a user