Skip to content

Commit

Permalink
Do not deduplicate diagnostics in UI tests by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexendoo committed Feb 28, 2024
1 parent 1013617 commit ae08cd2
Show file tree
Hide file tree
Showing 51 changed files with 375 additions and 318 deletions.
1 change: 1 addition & 0 deletions tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ fn base_config(test_dir: &str) -> (Config, Args) {
"-Aunused",
"-Ainternal_features",
"-Zui-testing",
"-Zdeduplicate-diagnostics=no",
"-Dwarnings",
&format!("-Ldependency={}", deps_path.display()),
]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-internal/custom_ice_message.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy

note: rustc <version> running on <target>

note: compiler flags: -Z ui-testing
note: compiler flags: -Z ui-testing -Z deduplicate-diagnostics=no

note: Clippy version: foo

2 changes: 2 additions & 0 deletions tests/ui/assign_ops2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//@no-rustfix: overlapping suggestions
//@compile-flags: -Zdeduplicate-diagnostics=yes

#![allow(clippy::uninlined_format_args)]

#[allow(unused_assignments)]
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/assign_ops2.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:8:5
--> tests/ui/assign_ops2.rs:10:5
|
LL | a += a + 1;
| ^^^^^^^^^^
Expand All @@ -16,7 +16,7 @@ LL | a = a + a + 1;
| ~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:11:5
--> tests/ui/assign_ops2.rs:13:5
|
LL | a += 1 + a;
| ^^^^^^^^^^
Expand All @@ -31,7 +31,7 @@ LL | a = a + 1 + a;
| ~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:13:5
--> tests/ui/assign_ops2.rs:15:5
|
LL | a -= a - 1;
| ^^^^^^^^^^
Expand All @@ -46,7 +46,7 @@ LL | a = a - (a - 1);
| ~~~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:15:5
--> tests/ui/assign_ops2.rs:17:5
|
LL | a *= a * 99;
| ^^^^^^^^^^^
Expand All @@ -61,7 +61,7 @@ LL | a = a * a * 99;
| ~~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:17:5
--> tests/ui/assign_ops2.rs:19:5
|
LL | a *= 42 * a;
| ^^^^^^^^^^^
Expand All @@ -76,7 +76,7 @@ LL | a = a * 42 * a;
| ~~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:19:5
--> tests/ui/assign_ops2.rs:21:5
|
LL | a /= a / 2;
| ^^^^^^^^^^
Expand All @@ -91,7 +91,7 @@ LL | a = a / (a / 2);
| ~~~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:21:5
--> tests/ui/assign_ops2.rs:23:5
|
LL | a %= a % 5;
| ^^^^^^^^^^
Expand All @@ -106,7 +106,7 @@ LL | a = a % (a % 5);
| ~~~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:23:5
--> tests/ui/assign_ops2.rs:25:5
|
LL | a &= a & 1;
| ^^^^^^^^^^
Expand All @@ -121,7 +121,7 @@ LL | a = a & a & 1;
| ~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:25:5
--> tests/ui/assign_ops2.rs:27:5
|
LL | a *= a * a;
| ^^^^^^^^^^
Expand All @@ -136,7 +136,7 @@ LL | a = a * a * a;
| ~~~~~~~~~~~~~

error: manual implementation of an assign operation
--> tests/ui/assign_ops2.rs:63:5
--> tests/ui/assign_ops2.rs:65:5
|
LL | buf = buf + cows.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/else_if_without_else.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes

#![warn(clippy::all)]
#![warn(clippy::else_if_without_else)]

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/else_if_without_else.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `if` expression with an `else if`, but without a final `else`
--> tests/ui/else_if_without_else.rs:45:12
--> tests/ui/else_if_without_else.rs:47:12
|
LL | } else if bla2() {
| ____________^
Expand All @@ -13,7 +13,7 @@ LL | | }
= help: to override `-D warnings` add `#[allow(clippy::else_if_without_else)]`

error: `if` expression with an `else if`, but without a final `else`
--> tests/ui/else_if_without_else.rs:54:12
--> tests/ui/else_if_without_else.rs:56:12
|
LL | } else if bla3() {
| ____________^
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/identity_op.fixed
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes

#![warn(clippy::identity_op)]
#![allow(unused)]
#![allow(
Expand Down Expand Up @@ -134,7 +136,7 @@ fn main() {
//~^ ERROR: this operation has no effect
f(if b { 1 } else { 2 } + 3);
//~^ ERROR: this operation has no effect

const _: i32 = { 2 * 4 } + 3;
//~^ ERROR: this operation has no effect
const _: i32 = { 1 + 2 * 3 } + 3;
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/identity_op.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes

#![warn(clippy::identity_op)]
#![allow(unused)]
#![allow(
Expand Down Expand Up @@ -134,7 +136,7 @@ fn main() {
//~^ ERROR: this operation has no effect
f(0 + if b { 1 } else { 2 } + 3);
//~^ ERROR: this operation has no effect

const _: i32 = { 2 * 4 } + 0 + 3;
//~^ ERROR: this operation has no effect
const _: i32 = 0 + { 1 + 2 * 3 } + 3;
Expand Down
Loading

0 comments on commit ae08cd2

Please sign in to comment.