Closed
Description
Lint Name
duplicated_attributes
Reproducer
#[cfg(any(
all(
target_os = "linux",
any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "s390x",
target_arch = "riscv64",
target_arch = "riscv32"
)
),
all(
target_os = "android",
any(target_arch = "aarch64", target_arch = "arm")
),
))]
pub type c_char = u8;
$ cargo clippy
warning: duplicated attribute
--> src/main.rs:17:13
|
17 | any(target_arch = "aarch64", target_arch = "arm")
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: first defined here
--> src/main.rs:5:13
|
5 | target_arch = "aarch64",
| ^^^^^^^^^^^^^^^^^^^^^^^
help: remove this attribute
--> src/main.rs:17:13
|
17 | any(target_arch = "aarch64", target_arch = "arm")
| ^^^^^^^^^^^^^^^^^^^^^^^
= 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
warning: duplicated attribute
--> src/main.rs:17:38
|
17 | any(target_arch = "aarch64", target_arch = "arm")
| ^^^^^^^^^^^^^^^^^^^
|
note: first defined here
--> src/main.rs:6:13
|
6 | target_arch = "arm",
| ^^^^^^^^^^^^^^^^^^^
help: remove this attribute
--> src/main.rs:17:38
|
17 | any(target_arch = "aarch64", target_arch = "arm")
| ^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicated_attributes
Clippy just says "remove this attribute" but doing so would violate the intended meaning of the program.
The case shown as an example of the intended purpose of this lint in https://rust-lang.github.io/rust-clippy/master/index.html#/duplicated_attributes (#[allow(dead_code)] #[allow(dead_code)]
) seems like a quite different thing than this one.
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