Use `#[allow(clippy::enum_variant_names)]` on a enum variant

Here is my problem. I have the following type.

enum Shell {
    Bash,
    Elvish,
    Fish,
    PowerShell,
    Zsh
}

This type does trigger the clippy::enum_variant_name warning because PowerShell does end with Shell which is the name of the type itself.

warning: variant name ends with the enum's name
  --> fofil-cli/src/cli.rs:40:5
   |
40 |     PowerShell,
   |     ^^^^^^^^^^
   |
   = note: `#[warn(clippy::enum_variant_names)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

I understand the clippy and it definitely looks like a good example where I should temporarily deactivate clippy. However, it seems I cannot do the following:

enum Shell {
    Bash,
    Elvish,
    Fish,
    #[allow(clippy::enum_variant_names)]
    PowerShell,
    Zsh
}

but I have to deactivate the lint on the entire type like this:

#[allow(clippy::enum_variant_names)]
pub enum Shell {
    Bash,
    Elvish,
    Fish,
    PowerShell,
    Zsh,
}

which is a wider scope that I ideally need. Did I miss something that would make it narrower? Or am I looking for something that is not possible at the moment (I can live with that)?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.