Closed
Description
Summary
For this particular lint, module-level #![allow(clippy::duplicated_attributes)]
suppresses occurrences of the lint within that module, and within in-line modules in the same file, but not in modules from other files.
This behavior is unlike what happens with allow
for all other clippy lints, in which it applies to the whole module hierarchy across files.
Reproducer
// src/lib.rs
#![allow(clippy::duplicated_attributes)]
pub mod here {
#[allow(dead_code)]
#[allow(dead_code)]
pub fn foo() {}
}
pub mod there;
// src/there.rs
#[allow(dead_code)]
#[allow(dead_code)]
pub fn foo() {}
$ cargo clippy
warning: duplicated attribute
--> src/there.rs:4:9
|
4 | #[allow(dead_code)]
| ^^^^^^^^^
|
note: first defined here
--> src/there.rs:3:9
|
3 | #[allow(dead_code)]
| ^^^^^^^^^
help: remove this attribute
--> src/there.rs:4:9
|
4 | #[allow(dead_code)]
| ^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes
= note: `#[warn(clippy::duplicated_attributes)]` on by default
The occurrence within mod here
is suppressed by the allow
but the one within mod there
is not.
Version
rustc 1.79.0-nightly (85e449a32 2024-03-22)
binary: rustc
commit-hash: 85e449a3237e82c9ade8936a82bd4fc64cfe1057
commit-date: 2024-03-22
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
Additional Labels
No response