Closed
Description
Summary
I ran clippy on the standard library and it complained about duplicated attributes that were not duplicated.
This does not affect the new diagnostic::on_unimplemented
attribute, as it does not support on
syntax.
Lint Name
duplicated_attributes
Reproducer
I tried this code:
#![feature(rustc_attrs)]
#[rustc_on_unimplemented(
on(
_Self = "&str",
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
),
on(
_Self = "alloc::string::String",
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
),
)]
trait X {}
fn main() {}
I saw this happen:
warning: duplicated attribute
--> uwuclip.rs:10:9
|
10 | label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first defined here
--> uwuclip.rs:6:9
|
6 | label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: remove this attribute
--> uwuclip.rs:10:9
|
10 | label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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
I expected to see this happen:
No lints, this is some excellent code straight from the standard library
Version
rustc 1.79.0-nightly (8df7e723e 2024-03-30)
binary: rustc
commit-hash: 8df7e723ea729a7f917501cc2d91d640b7021373
commit-date: 2024-03-30
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
Additional Labels
No response