1
Fork 0

Avoid ref when using format! for perf

Clean up a few minor refs in `format!` macro, as it has a tiny perf
cost. A few more minor related cleanups.
This commit is contained in:
Yuri Astrakhan 2024-07-19 11:51:21 -04:00
parent d3dd34a1d4
commit 91275b2c2b
5 changed files with 6 additions and 6 deletions

View file

@ -1544,10 +1544,10 @@ impl fmt::Debug for Literal {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Literal")
// format the kind on one line even in {:#?} mode
.field("kind", &format_args!("{:?}", &self.0.kind))
.field("kind", &format_args!("{:?}", self.0.kind))
.field("symbol", &self.0.symbol)
// format `Some("...")` on one line even in {:#?} mode
.field("suffix", &format_args!("{:?}", &self.0.suffix))
.field("suffix", &format_args!("{:?}", self.0.suffix))
.field("span", &self.0.span)
.finish()
}