RS.CLIPPY.EXPLICIT_WRITE
Using the `write!()` family of functions instead of the `print!()` family of functions, when using the latter would work
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: explicit_write. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for usage of write!() / writeln()! which can be
replaced with (e)print!() / (e)println!()
Why is this bad?
Using (e)println! is clearer and more concise
Example
writeln!(&mut std::io::stderr(), "foo: {:?}", bar).unwrap();
writeln!(&mut std::io::stdout(), "foo: {:?}", bar).unwrap();
Use instead:
eprintln!("foo: {:?}", bar);
println!("foo: {:?}", bar);