Required arg with <TYPE> tag and default value always errors in debug build but never in release #3597
Closed
2 tasks done
Labels
C-bug
Category: Updating dependencies
Please complete the following tasks
Rust Version
rustc 1.59.0 (9d1b2106e 2022-02-23)
Clap Version
3.1.6
Minimal reproducible code
Steps to reproduce the bug with the above code
These
cargo run -- --foo bar
cargo run --release -- --foo bar
give differing results
Actual Behaviour
Running a debug build
cargo run -- --foo bar
orcargo run
results in:thread 'main' panicked at 'Argument 'foo' is required and can't have a default value'
But running a release build with the flag set
cargo run --release -- --foo bar
results in:bar
And leaving the flag out
cargo run --release
results in:default
Expected Behaviour
When running with the flag it should never error. When leaving out the flag I am not certain what the correct behaviour is but it should be consistent between debug and release builds.
Additional Context
No response
Debug Output
For
cargo run -- --foo bar
:For
cargo run --release -- --foo bar
:The text was updated successfully, but these errors were encountered: