]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_unfulfilled.rs
Rollup merge of #106709 - khuey:disable_split_dwarf_inlining_by_default, r=davidtwco
[rust.git] / tests / ui / lint / rfc-2383-lint-reason / force_warn_expected_lints_unfulfilled.rs
1 // compile-flags: --force-warn while_true
2 // compile-flags: --force-warn unused_variables
3 // compile-flags: --force-warn unused_mut
4 // check-pass
5
6 #![feature(lint_reasons)]
7
8 fn expect_early_pass_lint(terminate: bool) {
9     #[expect(while_true)]
10     //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
11     //~| NOTE `#[warn(unfulfilled_lint_expectations)]` on by default
12     while !terminate {
13         println!("Do you know what a spin lock is?")
14     }
15 }
16
17 #[expect(unused_variables, reason="<this should fail and display this reason>")]
18 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
19 //~| NOTE <this should fail and display this reason>
20 fn check_specific_lint() {
21     let _x = 2;
22 }
23
24 #[expect(unused)]
25 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
26 fn check_multiple_lints_with_lint_group() {
27     let fox_name = "Sir Nibbles";
28
29     let what_does_the_fox_say = "*ding* *deng* *dung*";
30
31     println!("The fox says: {what_does_the_fox_say}");
32     println!("~ {fox_name}")
33 }
34
35
36 #[expect(unused)]
37 //~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
38 fn check_overridden_expectation_lint_level() {
39     #[allow(unused_variables)]
40     let this_should_not_fulfill_the_expectation = "maybe";
41     //~^ WARNING unused variable: `this_should_not_fulfill_the_expectation` [unused_variables]
42     //~| NOTE requested on the command line with `--force-warn unused-variables`
43     //~| HELP if this is intentional, prefix it with an underscore
44 }
45
46 fn main() {
47     check_multiple_lints_with_lint_group();
48     check_overridden_expectation_lint_level();
49 }