RS.CLIPPY.PRINT_LITERAL

Printing 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: print_literal. Copyright ©2025 The Rust Team. All rights reserved.

What it does

This lint warns about the use of literals as print!/println! args.

Why is this bad?

Using literals as println! 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

println!("{}", "foo");

use the literal without formatting:

println!("foo");