Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

benchy: The default value of --api-version does not work properly #1589

Closed
0x5459 opened this issue Apr 24, 2022 · 0 comments · Fixed by #1590
Closed

benchy: The default value of --api-version does not work properly #1589

0x5459 opened this issue Apr 24, 2022 · 0 comments · Fixed by #1590
Labels
good first issue Good for newcomers

Comments

@0x5459
Copy link
Contributor

0x5459 commented Apr 24, 2022

Description

Running benchy in debug mode and without the --api-version argument will panic.

cargo run --bin=benchy -- window-post --size=2KiB

error:

thread 'main' panicked at 'Argument 'api_version' is required and can't have a default value' ...

.required(true) and .default_value("some value") are conflicting in clap, if required is set to true, default value will not work properly.
https://github.com/clap-rs/clap/blob/406bfbd3dc472baf402f1f16cd58b5bc7d11fac4/src/build/debug_asserts.rs#L613-#L619

Where to begin

Remove .required(true).

Arg::new("api_version")
.long("api-version")
.required(true)
.help("The api_version to use (default: 1.1.0)")
.default_value("1.1.0")
.takes_value(true),

Arg::new("api_version")
.long("api-version")
.required(true)
.help("The api_version to use (default: 1.1.0)")
.default_value("1.1.0")
.takes_value(true),

Arg::new("api_version")
.long("api-version")
.required(true)
.help("The api_version to use (default: 1.1.0)")
.default_value("1.1.0")
.takes_value(true),

Arg::new("size")
.required(true)
.long("size")
.default_value("34359738368")
.help("The data size in bytes")
.takes_value(true),

Arg::new("size")
.required(true)
.long("size")
.default_value("34359738368")
.help("The data size in bytes")
.takes_value(true),

Arg::new("size")
.required(true)
.long("size")
.default_value("34359738368")
.help("The data size in bytes")
.takes_value(true),

Can i fix it? thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants