Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format and print macros aren't detected anymore #2041

Closed
oli-obk opened this issue Sep 11, 2017 · 0 comments
Closed

format and print macros aren't detected anymore #2041

oli-obk opened this issue Sep 11, 2017 · 0 comments
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing E-medium Call for participation: Medium difficulty level problem and requires some initial experience.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Sep 11, 2017

Our tests have improved in some cases and worsened in others due to rust-lang/rust#44312

diff --git a/tests/ui/format.stderr b/tests/ui/format.stderr
index d2c9f393..5f5bdc02 100644
--- a/tests/ui/format.stderr
+++ b/tests/ui/format.stderr
@@ -6,17 +6,5 @@ error: useless use of `format!`
  |
  = note: `-D useless-format` implied by `-D warnings`

-error: useless use of `format!`
- --> $DIR/format.rs:8:5
-  |
-8 |     format!("{}", "foo");
-  |     ^^^^^^^^^^^^^^^^^^^^^
-
-error: useless use of `format!`
-  --> $DIR/format.rs:15:5
-   |
-15 |     format!("{}", arg);
-   |     ^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error

diff --git a/tests/ui/matches.stderr b/tests/ui/matches.stderr
index 29a558ae..2f55428c 100644
--- a/tests/ui/matches.stderr
+++ b/tests/ui/matches.stderr
@@ -249,6 +249,25 @@ error: Err(_) will match all errors, maybe not a good idea
    = note: `-D match-wild-err-arm` implied by `-D warnings`
    = note: to remove this warning, match each error seperately or use unreachable macro

+error: this `match` has identical arm bodies
+   --> $DIR/matches.rs:239:18
+    |
+239 |         Ok(_) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    |
+    = note: `-D match-same-arms` implied by `-D warnings`
+note: same as this
+   --> $DIR/matches.rs:238:18
+    |
+238 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+   --> $DIR/matches.rs:238:18
+    |
+238 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    = note: this error originates in a macro outside of the current crate
+
error: Err(_) will match all errors, maybe not a good idea
   --> $DIR/matches.rs:246:9
    |
@@ -257,6 +276,24 @@ error: Err(_) will match all errors, maybe not a good idea
    |
    = note: to remove this warning, match each error seperately or use unreachable macro

+error: this `match` has identical arm bodies
+   --> $DIR/matches.rs:245:18
+    |
+245 |         Ok(_) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    |
+note: same as this
+   --> $DIR/matches.rs:244:18
+    |
+244 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+   --> $DIR/matches.rs:244:18
+    |
+244 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    = note: this error originates in a macro outside of the current crate
+
error: Err(_) will match all errors, maybe not a good idea
   --> $DIR/matches.rs:252:9
    |
@@ -265,5 +302,95 @@ error: Err(_) will match all errors, maybe not a good idea
    |
    = note: to remove this warning, match each error seperately or use unreachable macro

-error: aborting due to 26 previous errors
+error: this `match` has identical arm bodies
+   --> $DIR/matches.rs:251:18
+    |
+251 |         Ok(_) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    |
+note: same as this
+   --> $DIR/matches.rs:250:18
+    |
+250 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+   --> $DIR/matches.rs:250:18
+    |
+250 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    = note: this error originates in a macro outside of the current crate
+
+error: this `match` has identical arm bodies
+   --> $DIR/matches.rs:258:18
+    |
+258 |         Ok(_) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    |
+note: same as this
+   --> $DIR/matches.rs:257:18
+    |
+257 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+   --> $DIR/matches.rs:257:18
+    |
+257 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    = note: this error originates in a macro outside of the current crate
+
+error: this `match` has identical arm bodies
+   --> $DIR/matches.rs:265:18
+    |
+265 |         Ok(_) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    |
+note: same as this
+   --> $DIR/matches.rs:264:18
+    |
+264 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+   --> $DIR/matches.rs:264:18
+    |
+264 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    = note: this error originates in a macro outside of the current crate
+
+error: this `match` has identical arm bodies
+   --> $DIR/matches.rs:271:18
+    |
+271 |         Ok(_) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    |
+note: same as this
+   --> $DIR/matches.rs:270:18
+    |
+270 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+   --> $DIR/matches.rs:270:18
+    |
+270 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    = note: this error originates in a macro outside of the current crate
+
+error: this `match` has identical arm bodies
+   --> $DIR/matches.rs:277:18
+    |
+277 |         Ok(_) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    |
+note: same as this
+   --> $DIR/matches.rs:276:18
+    |
+276 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+   --> $DIR/matches.rs:276:18
+    |
+276 |         Ok(3) => println!("ok"),
+    |                  ^^^^^^^^^^^^^^
+    = note: this error originates in a macro outside of the current crate
+
+error: aborting due to 33 previous errors

diff --git a/tests/ui/print_with_newline.stderr b/tests/ui/print_with_newline.stderr
index 1bacc40b..e69de29b 100644
--- a/tests/ui/print_with_newline.stderr
+++ b/tests/ui/print_with_newline.stderr
@@ -1,28 +0,0 @@
-error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
- --> $DIR/print_with_newline.rs:6:5
-  |
-6 |     print!("Hello/n");
-  |     ^^^^^^^^^^^^^^^^^^
-  |
-  = note: `-D print-with-newline` implied by `-D warnings`
-
-error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
- --> $DIR/print_with_newline.rs:7:5
-  |
-7 |     print!("Hello {}/n", "world");
-  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
- --> $DIR/print_with_newline.rs:8:5
-  |
-8 |     print!("Hello {} {}/n/n", "world", "#2");
-  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
- --> $DIR/print_with_newline.rs:9:5
-  |
-9 |     print!("{}/n", 1265);
-  |     ^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 4 previous errors
-
@oli-obk oli-obk added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. C-bug Category: Clippy is not doing the correct thing labels Sep 11, 2017
oli-obk added a commit that referenced this issue Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing E-medium Call for participation: Medium difficulty level problem and requires some initial experience.
Projects
None yet
Development

No branches or pull requests

2 participants