2021-08-06 16:38:09 -05:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
|
|
|
#![feature(lint_reasons)]
|
|
|
|
#![warn(unused_mut)]
|
|
|
|
|
|
|
|
#[expect(
|
|
|
|
unused_mut,
|
2021-11-24 14:57:38 -06:00
|
|
|
//~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
|
2022-03-02 11:10:07 -06:00
|
|
|
//~| NOTE `#[warn(unfulfilled_lint_expectations)]` on by default
|
2021-11-24 14:57:38 -06:00
|
|
|
//~| NOTE this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered
|
2021-08-06 16:38:09 -05:00
|
|
|
reason = "this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered"
|
|
|
|
)]
|
|
|
|
mod foo {
|
|
|
|
fn bar() {
|
|
|
|
#[allow(
|
|
|
|
unused_mut,
|
|
|
|
reason = "this overrides the previous `expect` lint level and allows the `unused_mut` lint here"
|
|
|
|
)]
|
|
|
|
let mut v = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[expect(
|
|
|
|
unused_mut,
|
2021-11-24 14:57:38 -06:00
|
|
|
//~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
|
|
|
|
//~| NOTE this `expect` is overridden by a `warn` attribute before the `unused_mut` lint is triggered
|
2021-08-06 16:38:09 -05:00
|
|
|
reason = "this `expect` is overridden by a `warn` attribute before the `unused_mut` lint is triggered"
|
|
|
|
)]
|
|
|
|
mod oof {
|
|
|
|
#[warn(
|
|
|
|
unused_mut,
|
|
|
|
//~^ NOTE the lint level is defined here
|
|
|
|
reason = "this overrides the previous `expect` lint level and warns about the `unused_mut` lint here"
|
|
|
|
)]
|
|
|
|
fn bar() {
|
|
|
|
let mut v = 0;
|
|
|
|
//~^ WARNING variable does not need to be mutable [unused_mut]
|
|
|
|
//~| NOTE this overrides the previous `expect` lint level and warns about the `unused_mut` lint here
|
2021-11-25 03:45:25 -06:00
|
|
|
//~| HELP remove this `mut`
|
2021-08-06 16:38:09 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-25 03:45:25 -06:00
|
|
|
#[expect(unused_variables)]
|
|
|
|
//~^ WARNING this lint expectation is unfulfilled
|
|
|
|
#[forbid(unused_variables)]
|
|
|
|
//~^ NOTE the lint level is defined here
|
|
|
|
fn check_expect_then_forbid() {
|
|
|
|
let this_is_my_function = 3;
|
|
|
|
//~^ ERROR unused variable: `this_is_my_function` [unused_variables]
|
|
|
|
//~| HELP if this is intentional, prefix it with an underscore
|
|
|
|
}
|
|
|
|
|
2021-08-06 16:38:09 -05:00
|
|
|
fn main() {}
|