According to this answer, #[allow(dead_code)] should work, but it doesn't
fn main() {
#[allow(dead_code)]
let x = 0;
}
These are different lints. dead_code refers to unused code at the item level, e.g. imports, functions and types. unused_variables refers to variables that are never accessed.
You can also cover both cases with #[allow(unused)].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With