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

Fix abort message when deriving non-unit enum variants #4118

Merged
merged 1 commit into from Aug 26, 2022
Merged

Fix abort message when deriving non-unit enum variants #4118

merged 1 commit into from Aug 26, 2022

Conversation

miguelff
Copy link
Contributor

This PR fixes the abort! message when applying the derive directive to enums containing variants that are non-unit.

I found the previous message confusing due to using double negation:

"#[derive(ValueEnum)] only supports non-unit variants, unless they are skipped"

I believe the message should instead be:

"#[derive(ValueEnum)] only supports non-unit variants if they are skipped"

Or even more explicit, as provided in the patch:

"#[derive(ValueEnum)] only supports unit variants. Non-unit variants must be skipped"

Clarify that only unit variants are fully supported, and that
non-unit variants must be skipped.
@epage epage merged commit b1e3dad into clap-rs:master Aug 26, 2022
@epage
Copy link
Member

epage commented Aug 26, 2022

Thanks! I like that wording!

This got merged into master which is for v4. You are welcome to backport this to v3-master if you wish.

@miguelff
Copy link
Contributor Author

You are welcome to backport this to v3-master if you wish.

Done in #4124

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

Successfully merging this pull request may close these issues.

None yet

2 participants