strum
strum copied to clipboard
Disabled variant still included in VariantNames
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",
];
}
I'm facing the same issue. I'm happy to work on a fix for this and open a PR. @Peternator7
Hi @Peternator7 👋
I was recently facing an issue related to this and took up on fixing it. I also have a PR containing a new test to check for this as well as an implemented fix to resolve this (#369 ).