From 3e143cf5f6f3c575db5c90bafd7518cdb1a82b21 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:04:31 +1000 Subject: [PATCH] remove need for use with macro so macro is self contained --- cmd/soroban-cli/src/fee.rs | 1 - cmd/soroban-cli/src/utils.rs | 22 ++++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cmd/soroban-cli/src/fee.rs b/cmd/soroban-cli/src/fee.rs index 37fcff321..e36610371 100644 --- a/cmd/soroban-cli/src/fee.rs +++ b/cmd/soroban-cli/src/fee.rs @@ -1,5 +1,4 @@ use clap::arg; -use clap::builder::TypedValueParser; use crate::assembled::Assembled; use soroban_env_host::xdr; diff --git a/cmd/soroban-cli/src/utils.rs b/cmd/soroban-cli/src/utils.rs index 3313943ac..2460d7370 100644 --- a/cmd/soroban-cli/src/utils.rs +++ b/cmd/soroban-cli/src/utils.rs @@ -197,21 +197,19 @@ pub mod http { } pub mod args { - /// Mark argument as deprecated with warning to be printed when it's used. Note: marco is only - /// supported for `bool` and `String` and is required to add - /// ``` - /// use clap::builder::TypedValueParser; - /// ``` - /// When using the marco + /// Mark argument as deprecated with warning to be printed when it's used. #[macro_export] macro_rules! deprecated_arg { (bool, $message: expr) => { - clap::builder::BoolValueParser::new().map(|x| { - if (x) { - $crate::print::Print::new(false).warnln($message); - } - x - }) + <_ as clap::builder::TypedValueParser>::map( + clap::builder::BoolValueParser::new(), + |x| { + if (x) { + $crate::print::Print::new(false).warnln($message); + } + x + }, + ) }; } }