From c596b845c398fc67fa119f10dad972f5d0b6452d Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Sat, 3 Aug 2024 05:44:08 +0000 Subject: [PATCH] Display default value for `--maximum-resolution-timeout` in help --- crates/bin/src/args.rs | 5 +++-- crates/bin/src/entry.rs | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/bin/src/args.rs b/crates/bin/src/args.rs index 2683601f..dab59064 100644 --- a/crates/bin/src/args.rs +++ b/crates/bin/src/args.rs @@ -191,9 +191,10 @@ pub struct Args { #[clap( help_heading = "Overrides", long, - env = "BINSTALL_MAXIMUM_RESOLUTION_TIMEOUT" + env = "BINSTALL_MAXIMUM_RESOLUTION_TIMEOUT", + default_value_t = NonZeroU16::new(180).unwrap(), )] - pub(crate) maximum_resolution_timeout: Option, + pub(crate) maximum_resolution_timeout: NonZeroU16, /// This flag is now enabled by default thus a no-op. /// diff --git a/crates/bin/src/entry.rs b/crates/bin/src/entry.rs index 79e79401..9709736f 100644 --- a/crates/bin/src/entry.rs +++ b/crates/bin/src/entry.rs @@ -210,10 +210,9 @@ pub fn install_crates( }, disable_telemetry: args.disable_telemetry, - maximum_resolution_timeout: args - .maximum_resolution_timeout - .map(|n| Duration::from_secs(n.get().into())) - .unwrap_or(Duration::from_secs(180)), + maximum_resolution_timeout: Duration::from_secs( + args.maximum_resolution_timeout.get().into(), + ), }); // Destruct args before any async function to reduce size of the future