RS.CLIPPY.LITERAL_STRING_WITH_FORMATTING_ARGS
Checks if string literals have formatting arguments
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: literal_string_with_formatting_args. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks if string literals have formatting arguments outside of macros
using them (like format!).
Why is this bad?
It will likely not generate the expected content.
Example
let x: Option<usize> = None;
let y = "hello";
x.expect("{y:?}");
Use instead:
let x: Option<usize> = None;
let y = "hello";
x.expect(&format!("{y:?}"));