-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C-bugCategory: bugCategory: bugS-triageStatus: New; needs maintainer attention.Status: New; needs maintainer attention.
Description
Please complete the following tasks
- I have searched the discussions
- I have searched the open and rejected issues
Rust Version
rustc 1.93.0 (254b59607 2026-01-19)
Clap Version
4.5.57
Minimal reproducible code
use clap::Parser;
#[derive(Parser, Debug)]
struct Args {
#[arg(short = 'a', default_value_t = 1.0)]
amplify: f32,
}
fn main() {
let _ = Args::parse();
}Steps to reproduce the bug with the above code
- Build and run
cargo run -- --helpfrom any workspace containing the code above. - Observe the generated help text line for
-aargument.
Usage: playground [OPTIONS]
Options:
-a <AMPLIFY> [default: 1]
-h, --help Print help
Actual Behaviour
Clap displays the default as [default: 1] even though the default_value_t is 1.0.
Expected Behaviour
The help text should show [default: 1.0] for the --amplify argument, so the default is clearly presented as a floating-point value matching the configured literal.
Additional Context
If the 1.1 value is specified, then it displays the default value properly. The zero decimal (X.0) numbers are trimmed.
Debug Output
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bugS-triageStatus: New; needs maintainer attention.Status: New; needs maintainer attention.