]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/rfc-2383-lint-reason/expect_multiple_lints.rs
Auto merge of #106884 - clubby789:fieldless-enum-debug, r=michaelwoerister
[rust.git] / tests / ui / lint / rfc-2383-lint-reason / expect_multiple_lints.rs
1 // check-pass
2
3 #![feature(lint_reasons)]
4
5 #![warn(unused)]
6
7 // The warnings are not double triggers, they identify different unfulfilled lint
8 // expectations one for each listed lint.
9
10 #[expect(unused_variables, unused_mut, while_true)]
11 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
12 //~| NOTE `#[warn(unfulfilled_lint_expectations)]` on by default
13 //~| WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
14 fn check_multiple_lints_1() {
15     // This only trigger `unused_variables`
16     let who_am_i = 666;
17 }
18
19 #[expect(unused_variables, unused_mut, while_true)]
20 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
21 //~| WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
22 fn check_multiple_lints_2() {
23     // This only triggers `unused_mut`
24     let mut x = 0;
25     println!("I use x: {}", x);
26 }
27
28 #[expect(unused_variables, unused_mut, while_true)]
29 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
30 //~| WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
31 fn check_multiple_lints_3() {
32     // This only triggers `while_true` which is also an early lint
33     while true {}
34 }
35
36 #[expect(unused, while_true)]
37 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
38 fn check_multiple_lints_with_lint_group_1() {
39     let who_am_i = 666;
40
41     let mut x = 0;
42     println!("I use x: {}", x);
43 }
44
45 #[expect(unused, while_true)]
46 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
47 fn check_multiple_lints_with_lint_group_2() {
48     while true {}
49 }
50
51 fn main() {
52     check_multiple_lints_1();
53     check_multiple_lints_2();
54     check_multiple_lints_3();
55
56     check_multiple_lints_with_lint_group_1();
57     check_multiple_lints_with_lint_group_2();
58 }