-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
required
conflicts with required_unless*
#4715
Comments
required
conflicts with required_unless*
Even if we resolved things to prevent that assert, it would then fail at runtime. If the "unless" case happens, clap will have nothing to put into that field and will report an error. You either need to make the argument optional by changing the type from |
Yea, that makes sense. |
Yes, ideally, more of our checks would be done at compile-time. A couple of challenges with that
See also #3133 |
As it seems this direct issue is resolved, I'm going to go ahead and close thos |
Please complete the following tasks
Rust Version
1.67.1
Clap Version
4.1.6
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo run
Actual Behaviour
'main' panicked at 'Argument test:
required
conflicts withrequired_unless*
', /home/luna/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-4.1.6/src/builder/debug_asserts.rs:186:13Expected Behaviour
required_unless*
should automatically infer removerequired
and the code example should run normallyAdditional Context
Currently to fix this issue you need to add
default_value
to the arg definition, and then it works as expectedDebug Output
No response
The text was updated successfully, but these errors were encountered: