Use write_str
instead of write!
or write_fmt
when format has no args
#12240
Labels
A-lint
Area: New lints
What it does
Despite amazing efforts by @m-ou-se, it seems the generated assembly code for
write!(f, "something")
is still far more complex (and likely slower) thanf.write_str("something")
. While eventually I do hope it will get solved, I think Clippy can already help users to improve their code performance by suggesting to switch towrite_str
where possible.Advantage
Drawbacks
write!
Example
Could be written as:
The text was updated successfully, but these errors were encountered: