Navigation Menu

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 invalid_value returning an Error with no info #2700

Merged
merged 1 commit into from Aug 14, 2021
Merged

Fix invalid_value returning an Error with no info #2700

merged 1 commit into from Aug 14, 2021

Conversation

TheDaemoness
Copy link
Contributor

When constructing the Error for an invalid value, an info Vec is constructed, populated with the argument, the invalid value, and possible valid values… and then discarded and an empty Vec is used instead.

I can only assume this is unintentional, so this PR fixes that.

Copy link
Member

@ldm0 ldm0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@TheDaemoness
Copy link
Contributor Author

Side note that's only somewhat related to this PR: I noticed that missing_subcommand also uses an empty Vec for info, when name is used in the generation of the error message.

I assume that name is the name of the application, which someone writing their own error messages would likely already have access to (:grin:), but I thought I'd bring it up in case my assumption is wrong.

@pksunkara pksunkara merged commit c15b894 into clap-rs:master Aug 14, 2021
@TheDaemoness TheDaemoness deleted the patch-1 branch August 14, 2021 21:34
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

3 participants