RS.CLIPPY.WRITE_LITERAL
Writing a literal with a format string
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: write_literal. Copyright ©2025 The Rust Team. All rights reserved.
What it does
This lint warns about the use of literals as write!/writeln! args.
Why is this bad?
Using literals as writeln! args is inefficient
(c.f., https://github.com/matthiaskrgr/rust-str-bench) and unnecessary
(i.e., just put the literal in the format string)
Example
writeln!(buf, "{}", "foo");
Use instead:
writeln!(buf, "foo");