mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
ef72b2cac0
Both regular strings and raw strings can contain literal newlines. This commit extends the lint to also warn about terminating strings with these. Behaviour handling for raw strings is also moved into `check_newlines` by passing in the `is_raw` boolean from `check_tts` as [suggested](https://github.com/rust-lang/rust-clippy/pull/3781#pullrequestreview-204663732)
52 lines
1.7 KiB
Text
52 lines
1.7 KiB
Text
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
|
--> $DIR/print_with_newline.rs:5:5
|
|
|
|
|
LL | print!("Hello/n");
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::print-with-newline` implied by `-D warnings`
|
|
|
|
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
|
--> $DIR/print_with_newline.rs:6:5
|
|
|
|
|
LL | print!("Hello {}/n", "world");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
|
--> $DIR/print_with_newline.rs:7:5
|
|
|
|
|
LL | print!("Hello {} {}/n", "world", "#2");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
|
--> $DIR/print_with_newline.rs:8:5
|
|
|
|
|
LL | print!("{}/n", 1265);
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
|
--> $DIR/print_with_newline.rs:27:5
|
|
|
|
|
LL | print!("//n"); // should fail
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
|
--> $DIR/print_with_newline.rs:34:5
|
|
|
|
|
LL | / print!(
|
|
LL | | "
|
|
LL | | "
|
|
LL | | );
|
|
| |_____^
|
|
|
|
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
|
--> $DIR/print_with_newline.rs:38:5
|
|
|
|
|
LL | / print!(
|
|
LL | | r"
|
|
LL | | "
|
|
LL | | );
|
|
| |_____^
|
|
|
|
error: aborting due to 7 previous errors
|
|
|