#[derive(ArgEnum)]
fails silently on enums with non-unit variants
#3543
Labels
Milestone
#[derive(ArgEnum)]
fails silently on enums with non-unit variants
#3543
Discussed in #3533
Originally posted by Shir0kamii March 4, 2022
Hi!
I stumbled on a case where the derive implementation of ArgEnum does not produce its impl block without warning. It happens if the enum contains a non-unit variant.
If you try to compile code such as
The derive doesn't produce any code, and errors are later emitted, reporting that Test does not implement ArgEnum. I would consider that as a bug, because it is confusing and unfriendly. It would be better if an error was emitted from the macro.
I think I found the culprit and would be willing to contribute a fix.
However, while browsing similar issues, I found this discussion where one of you proposed then implemented a
#[clap(skip)]
attribute for skipping variants in ArgEnum implementation. I think that an enum with a skipped non-unit variant should not trigger any error, and instead produce a valid implementation. If you approve of it, I would like to help on that as well.What do you think?
The text was updated successfully, but these errors were encountered: