summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/eprint_with_newline.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /src/tools/clippy/tests/ui/eprint_with_newline.rs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/eprint_with_newline.rs')
-rw-r--r--src/tools/clippy/tests/ui/eprint_with_newline.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/tools/clippy/tests/ui/eprint_with_newline.rs b/src/tools/clippy/tests/ui/eprint_with_newline.rs
index 8389806c8..5b1140564 100644
--- a/src/tools/clippy/tests/ui/eprint_with_newline.rs
+++ b/src/tools/clippy/tests/ui/eprint_with_newline.rs
@@ -3,10 +3,16 @@
fn main() {
eprint!("Hello\n");
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
+ //~| NOTE: `-D clippy::print-with-newline` implied by `-D warnings`
eprint!("Hello {}\n", "world");
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
eprint!("Hello {} {}\n", "world", "#2");
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
eprint!("{}\n", 1265);
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
eprint!("\n");
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
// these are all fine
eprint!("");
@@ -20,23 +26,30 @@ fn main() {
eprint!("\n\n");
eprint!("like eof\n\n");
eprint!("Hello {} {}\n\n", "world", "#2");
- eprintln!("\ndon't\nwarn\nfor\nmultiple\nnewlines\n"); // #3126
- eprintln!("\nbla\n\n"); // #3126
+ // #3126
+ eprintln!("\ndon't\nwarn\nfor\nmultiple\nnewlines\n");
+ // #3126
+ eprintln!("\nbla\n\n");
// Escaping
- eprint!("\\n"); // #3514
- eprint!("\\\n"); // should fail
+ // #3514
+ eprint!("\\n");
+ eprint!("\\\n");
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
eprint!("\\\\n");
// Raw strings
- eprint!(r"\n"); // #3778
+ // #3778
+ eprint!(r"\n");
// Literal newlines should also fail
eprint!(
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
"
"
);
eprint!(
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
r"
"
);
@@ -45,6 +58,7 @@ fn main() {
eprint!("\r\n");
eprint!("foo\r\n");
eprint!("\\r\n");
+ //~^ ERROR: using `eprint!()` with a format string that ends in a single newline
eprint!("foo\rbar\n");
// Ignore expanded format strings