RS.CLIPPY.WRITE_WITH_NEWLINE

Using `write!()` with a format string that ends in a single newline

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

What it does

This lint warns when you use write!() with a format string that ends in a newline.

Why is this bad?

You should use writeln!() instead, which appends the newline.

Example

write!(buf, "Hello {}!\
", name);

Use instead:

writeln!(buf, "Hello {}!", name);