strum icon indicating copy to clipboard operation
strum copied to clipboard

EnumDiscriminants and non_exhaustive

Open ijackson opened this issue 7 months ago • 0 comments

Hi. Thanks for this excellent macro package.

We have something like this:

#![deny(clippy::exhaustive_enums)]

#[derive(strum::EnumDiscriminants)]
#[non_exhaustive]
pub enum ProxyAction {

This causes a warning from clippy, because the generated ProxyActionDiscriminants isn't marked #[non_exhaustive].

I tried

#[strum_discriminants(non_exhaustive)]

but strum rejected that because of a lack of () after non_exhaustive. (Adding them gets an error from rustc.)

I think we should probably allow the explicit attribute.

I'm not sure if we should forward the #[non_exhaustive] by default. If we do, there would have to be a way to suppress it.

ijackson avatar Apr 08 '25 12:04 ijackson