cf5d4a1b45
Literal `\n` characters (not a newline) in a `r"raw"` string should not fail the lint. This affects both write_with_newline and print_with_newline, so it is added in both places. I also copied a missing test case from write_with_newline over to print_with_newline and added a note that one of those tests is supposed to fail.
35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
|
--> $DIR/write_with_newline.rs:10:5
|
|
|
|
|
LL | write!(&mut v, "Hello/n");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::write-with-newline` implied by `-D warnings`
|
|
|
|
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
|
--> $DIR/write_with_newline.rs:11:5
|
|
|
|
|
LL | write!(&mut v, "Hello {}/n", "world");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
|
--> $DIR/write_with_newline.rs:12:5
|
|
|
|
|
LL | write!(&mut v, "Hello {} {}/n", "world", "#2");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
|
--> $DIR/write_with_newline.rs:13:5
|
|
|
|
|
LL | write!(&mut v, "{}/n", 1265);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
|
--> $DIR/write_with_newline.rs:32:5
|
|
|
|
|
LL | write!(&mut v, "//n"); // should fail
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 5 previous errors
|
|
|