-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
The #[allow(clippy::enum_variant_names)]
attribute is ignored when it's used on just an enum variant (it works fine if applied the whole enum).
Reproducer
I tried this code:
#[allow(dead_code)]
enum MyEnum {
#[allow(clippy::enum_variant_names)]
MyEnumIsGood,
Yes,
Hi,
}
fn main() {}
I expected to see this happen:
(No output from clippy)
Instead, this happened:
warning: variant name starts with the enum's name
--> src/main.rs:4:5
|
4 | MyEnumIsGood,
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
= note: `#[warn(clippy::enum_variant_names)]` on by default
Version
both stable and nightly
rustc 1.71.0-nightly (fec9adcdb 2023-04-21)
binary: rustc
commit-hash: fec9adcdbc21469ef105162cc8cabf81c72d06be
commit-date: 2023-04-21
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2
Additional Labels
@rustbot label +I-false-positive
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have