Skip to content

Commit 67e36af

Browse files
committed
add additional example in the error to showcase the behavior
1 parent 1e86580 commit 67e36af

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

tests/ui/lint/default-groups-issue-65464.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@
88
// in such tests, and the we're testing a scenario with no modification to the default settings.
99

1010
fn main() {
11+
// additional context is provided only if the level is not explicitly set
1112
let WrongCase = 1;
1213
//~^ WARN [non_snake_case]
1314
//~| NOTE `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default
15+
16+
// unchanged message if the level is explicitly set
17+
// even if the level is the same as the default
18+
#[warn(nonstandard_style)] //~ NOTE the lint level is defined here
19+
let WrongCase = 2;
20+
//~^ WARN [non_snake_case]
21+
//~| NOTE `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]`
1422
}
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
warning: variable `WrongCase` should have a snake case name
2-
--> $DIR/default-groups-issue-65464.rs:11:9
2+
--> $DIR/default-groups-issue-65464.rs:12:9
33
|
44
LL | let WrongCase = 1;
55
| ^^^^^^^^^ help: convert the identifier to snake case: `wrong_case`
66
|
77
= note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default
88

9-
warning: 1 warning emitted
9+
warning: variable `WrongCase` should have a snake case name
10+
--> $DIR/default-groups-issue-65464.rs:19:9
11+
|
12+
LL | let WrongCase = 2;
13+
| ^^^^^^^^^ help: convert the identifier to snake case: `wrong_case`
14+
|
15+
note: the lint level is defined here
16+
--> $DIR/default-groups-issue-65464.rs:18:12
17+
|
18+
LL | #[warn(nonstandard_style)]
19+
| ^^^^^^^^^^^^^^^^^
20+
= note: `#[warn(non_snake_case)]` implied by `#[warn(nonstandard_style)]`
21+
22+
warning: 2 warnings emitted
1023

0 commit comments

Comments
 (0)