diff --git a/token/cli/src/bench.rs b/token/cli/src/bench.rs index 02c7ae569e2..a224b2e8443 100644 --- a/token/cli/src/bench.rs +++ b/token/cli/src/bench.rs @@ -34,7 +34,7 @@ pub(crate) async fn bench_process_command( let token = pubkey_of_signer(arg_matches, "token", wallet_manager) .unwrap() .unwrap(); - let n = value_t_or_exit!(arg_matches, "n", usize); + let n = *arg_matches.get_one::("n").unwrap(); let (owner_signer, owner) = config.signer_or_default(arg_matches, "owner", wallet_manager); @@ -46,7 +46,7 @@ pub(crate) async fn bench_process_command( let token = pubkey_of_signer(arg_matches, "token", wallet_manager) .unwrap() .unwrap(); - let n = value_t_or_exit!(arg_matches, "n", usize); + let n = *arg_matches.get_one::("n").unwrap(); let (owner_signer, owner) = config.signer_or_default(arg_matches, "owner", wallet_manager); signers.push(owner_signer); @@ -57,7 +57,7 @@ pub(crate) async fn bench_process_command( let token = pubkey_of_signer(arg_matches, "token", wallet_manager) .unwrap() .unwrap(); - let n = value_t_or_exit!(arg_matches, "n", usize); + let n = *arg_matches.get_one::("n").unwrap(); let ui_amount = *arg_matches.get_one::("amount").unwrap(); let (owner_signer, owner) = config.signer_or_default(arg_matches, "owner", wallet_manager); @@ -72,7 +72,7 @@ pub(crate) async fn bench_process_command( let token = pubkey_of_signer(arg_matches, "token", wallet_manager) .unwrap() .unwrap(); - let n = value_t_or_exit!(arg_matches, "n", usize); + let n = *arg_matches.get_one::("n").unwrap(); let ui_amount = *arg_matches.get_one::("amount").unwrap(); let (owner_signer, owner) = config.signer_or_default(arg_matches, "owner", wallet_manager); diff --git a/token/cli/src/clap_app.rs b/token/cli/src/clap_app.rs index 617a6f8d36b..e084b5b0efa 100644 --- a/token/cli/src/clap_app.rs +++ b/token/cli/src/clap_app.rs @@ -7,9 +7,7 @@ use { solana_clap_v3_utils::{ fee_payer::fee_payer_arg, input_parsers::Amount, - input_validators::{ - is_parsable, is_pubkey, is_url_or_moniker, is_valid_pubkey, is_valid_signer, - }, + input_validators::{is_pubkey, is_url_or_moniker, is_valid_pubkey, is_valid_signer}, memo::memo_arg, nonce::*, offline::{self, *}, @@ -473,7 +471,7 @@ impl BenchSubCommand for App<'_> { ) .arg( Arg::with_name("n") - .validator(is_parsable::) + .value_parser(clap::value_parser!(usize)) .value_name("N") .takes_value(true) .index(2) @@ -496,7 +494,7 @@ impl BenchSubCommand for App<'_> { ) .arg( Arg::with_name("n") - .validator(is_parsable::) + .value_parser(clap::value_parser!(usize)) .value_name("N") .takes_value(true) .index(2) @@ -519,7 +517,7 @@ impl BenchSubCommand for App<'_> { ) .arg( Arg::with_name("n") - .validator(is_parsable::) + .value_parser(clap::value_parser!(usize)) .value_name("N") .takes_value(true) .index(2) @@ -559,7 +557,7 @@ impl BenchSubCommand for App<'_> { ) .arg( Arg::with_name("n") - .validator(is_parsable::) + .value_parser(clap::value_parser!(usize)) .value_name("N") .takes_value(true) .index(2) @@ -672,7 +670,7 @@ pub fn app<'a>( .takes_value(true) .global(true) .value_name("COMPUTE-UNIT-LIMIT") - .validator(is_parsable::) + .value_parser(clap::value_parser!(u32)) .help(COMPUTE_UNIT_LIMIT_ARG.help) ) .arg( @@ -681,7 +679,7 @@ pub fn app<'a>( .takes_value(true) .global(true) .value_name("COMPUTE-UNIT-PRICE") - .validator(is_parsable::) + .value_parser(clap::value_parser!(u64)) .help(COMPUTE_UNIT_PRICE_ARG.help) ) .bench_subcommand() diff --git a/token/cli/src/config.rs b/token/cli/src/config.rs index 97fd435a952..8469383498e 100644 --- a/token/cli/src/config.rs +++ b/token/cli/src/config.rs @@ -327,16 +327,10 @@ impl<'a> Config<'a> { .flatten() .copied(); - let compute_unit_price = matches - .try_get_one::(COMPUTE_UNIT_PRICE_ARG.name) - .ok() - .flatten() - .copied(); + let compute_unit_price = matches.get_one::(COMPUTE_UNIT_PRICE_ARG.name).copied(); let compute_unit_limit = matches - .try_get_one::(COMPUTE_UNIT_PRICE_ARG.name) - .ok() - .flatten() + .get_one::(COMPUTE_UNIT_LIMIT_ARG.name) .copied() .map(ComputeUnitLimit::Static) .unwrap_or_else(|| {