Skip to content

Commit 7e2f261

Browse files
Rollup merge of #133534 - RalfJung:cli-lint-flags, r=Nadrieril
extend group-forbid-always-trumps-cli test Test it not just for a lint group, but also an individual lint, or when mixing the lint and the group. And test both orders in which the flags could be passed.
2 parents b46ed71 + 37d3c61 commit 7e2f261

10 files changed

+88
-7
lines changed

tests/ui/lint/group-forbid-always-trumps-cli.stderr tests/ui/lint/forbid-always-trumps-cli.allow-first-group.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unused variable: `x`
2-
--> $DIR/group-forbid-always-trumps-cli.rs:4:9
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
33
|
44
LL | let x = 1;
55
| ^ help: if this is intentional, prefix it with an underscore: `_x`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unused variable: `x`
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: requested on the command line with `-F unused-variables`
8+
9+
error: aborting due to 1 previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unused variable: `x`
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: `-F unused-variables` implied by `-F unused`
8+
9+
error: aborting due to 1 previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unused variable: `x`
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: requested on the command line with `-F unused-variables`
8+
9+
error: aborting due to 1 previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unused variable: `x`
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: `-F unused-variables` implied by `-F unused`
8+
9+
error: aborting due to 1 previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unused variable: `x`
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: requested on the command line with `-F unused-variables`
8+
9+
error: aborting due to 1 previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unused variable: `x`
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: `-F unused-variables` implied by `-F unused`
8+
9+
error: aborting due to 1 previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: unused variable: `x`
2+
--> $DIR/forbid-always-trumps-cli.rs:15:9
3+
|
4+
LL | let x = 1;
5+
| ^ help: if this is intentional, prefix it with an underscore: `_x`
6+
|
7+
= note: requested on the command line with `-F unused-variables`
8+
9+
error: aborting due to 1 previous error
10+
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! Ensure that "forbid" always trumps" allow" in CLI arguments, no matter the order
2+
//! and no matter whether it is used with a lint group vs an individual lint.
3+
// ignore-tidy-linelength
4+
//@ revisions: forbid-first-group allow-first-group forbid-first-lint allow-first-lint forbid-first-mix1 allow-first-mix1 forbid-first-mix2 allow-first-mix2
5+
//@[forbid-first-group] compile-flags: -F unused -A unused
6+
//@[allow-first-group] compile-flags: -A unused -F unused
7+
//@[forbid-first-lint] compile-flags: -F unused_variables -A unused_variables
8+
//@[allow-first-lint] compile-flags: -A unused_variables -F unused_variables
9+
//@[forbid-first-mix1] compile-flags: -F unused -A unused_variables
10+
//@[allow-first-mix1] compile-flags: -A unused_variables -F unused
11+
//@[forbid-first-mix2] compile-flags: -F unused_variables -A unused
12+
//@[allow-first-mix2] compile-flags: -A unused -F unused_variables
13+
14+
fn main() {
15+
let x = 1;
16+
//~^ ERROR unused variable: `x`
17+
}

tests/ui/lint/group-forbid-always-trumps-cli.rs

-6
This file was deleted.

0 commit comments

Comments
 (0)