Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled variant still included in VariantNames #244

Open
Progdrasil opened this issue Oct 13, 2022 · 1 comment
Open

Disabled variant still included in VariantNames #244

Progdrasil opened this issue Oct 13, 2022 · 1 comment

Comments

@Progdrasil
Copy link

Progdrasil commented Oct 13, 2022

It is my understanding that the #[strum(disabled)] attribute should remove it from all the expansions. However, it seems that it is still included in the VariantNames trait implementation.

Example code

#[derive(strum::IntoVariantNames)]
enum Fields {
    Field0,
    Field1,
    Field2,
    #[strum(disabled)]
    Unknown,
}

Expected Output

impl ::strum::VariantNames for ResponseIdent {
        const VARIANTS: &'static [&'static str] = &[
            "Field0",
            "Field1",
            "Field2",
        ];
    }

Actual Output

impl ::strum::VariantNames for ResponseIdent {
        const VARIANTS: &'static [&'static str] = &[
            "Field0",
            "Field1",
            "Field2",
            "Unknown",
        ];
    }
@vspecky
Copy link

vspecky commented Jun 29, 2023

I'm facing the same issue. I'm happy to work on a fix for this and open a PR. @Peternator7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants