From cad63de65b25c7b7c58dc8849aa7a7fc26b22880 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:23:52 -0700 Subject: [PATCH 01/10] cli: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- cli/src/cluster_query.rs | 8 ++------ cli/src/wallet.rs | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index 9ffdd1f57ed8e7..4ee49d0285eb2c 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -54,11 +54,7 @@ use { slot_history, stake::{self, state::StakeState}, system_instruction, - sysvar::{ - self, - slot_history::SlotHistory, - stake_history::{self}, - }, + sysvar::{self, slot_history::SlotHistory, stake_history}, transaction::Transaction, }, solana_transaction_status::{ @@ -1109,7 +1105,7 @@ pub fn process_get_epoch_info(rpc_client: &RpcClient, config: &CliConfig) -> Pro match config.output_format { OutputFormat::Json | OutputFormat::JsonCompact => {} _ => { - let epoch_info = cli_epoch_info.epoch_info.clone(); + let epoch_info = &cli_epoch_info.epoch_info; let average_slot_time_ms = rpc_client .get_recent_performance_samples(Some(60)) .ok() diff --git a/cli/src/wallet.rs b/cli/src/wallet.rs index 9ed8a48c75bb8c..fe6877d6bcd7ca 100644 --- a/cli/src/wallet.rs +++ b/cli/src/wallet.rs @@ -568,7 +568,7 @@ pub fn process_show_account( use_lamports_unit: bool, ) -> ProcessResult { let account = rpc_client.get_account(account_pubkey)?; - let data = account.data.clone(); + let data = &account.data; let cli_account = CliAccount::new(account_pubkey, &account, use_lamports_unit); let mut account_string = config.output_format.formatted_string(&cli_account); @@ -585,7 +585,7 @@ pub fn process_show_account( OutputFormat::Display | OutputFormat::DisplayVerbose => { if let Some(output_file) = output_file { let mut f = File::create(output_file)?; - f.write_all(&data)?; + f.write_all(data)?; writeln!(&mut account_string)?; writeln!(&mut account_string, "Wrote account data to {output_file}")?; } else if !data.is_empty() { From a0755d38ef1f7030a59077fbc5c6f1f58f9bffa7 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:24:49 -0700 Subject: [PATCH 02/10] core: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- core/src/broadcast_stage.rs | 2 +- .../broadcast_fake_shreds_run.rs | 2 +- core/src/tower_storage.rs | 35 +++++++++---------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/core/src/broadcast_stage.rs b/core/src/broadcast_stage.rs index 89c05457b677c5..990760532dd956 100644 --- a/core/src/broadcast_stage.rs +++ b/core/src/broadcast_stage.rs @@ -648,7 +648,7 @@ pub mod test { let ticks_per_slot; let slot; { - let bank = broadcast_service.bank.clone(); + let bank = broadcast_service.bank; start_tick_height = bank.tick_height(); max_tick_height = bank.max_tick_height(); ticks_per_slot = bank.ticks_per_slot(); diff --git a/core/src/broadcast_stage/broadcast_fake_shreds_run.rs b/core/src/broadcast_stage/broadcast_fake_shreds_run.rs index 4a61ee378068ea..bdd9df54d18347 100644 --- a/core/src/broadcast_stage/broadcast_fake_shreds_run.rs +++ b/core/src/broadcast_stage/broadcast_fake_shreds_run.rs @@ -37,7 +37,7 @@ impl BroadcastRun for BroadcastFakeShredsRun { ) -> Result<()> { // 1) Pull entries from banking stage let receive_results = broadcast_utils::recv_slot_entries(receiver)?; - let bank = receive_results.bank.clone(); + let bank = receive_results.bank; let last_tick_height = receive_results.last_tick_height; let next_shred_index = blockstore diff --git a/core/src/tower_storage.rs b/core/src/tower_storage.rs index 353f11137a0d04..218e1b0b30b087 100644 --- a/core/src/tower_storage.rs +++ b/core/src/tower_storage.rs @@ -241,25 +241,22 @@ impl EtcdTowerStorage { .unwrap(); let client = runtime - .block_on(async { - etcd_client::Client::connect( - endpoints, - tls_config.map(|tls_config| { - etcd_client::ConnectOptions::default().with_tls( - etcd_client::TlsOptions::new() - .domain_name(tls_config.domain_name) - .ca_certificate(etcd_client::Certificate::from_pem( - tls_config.ca_certificate, - )) - .identity(etcd_client::Identity::from_pem( - tls_config.identity_certificate, - tls_config.identity_private_key, - )), - ) - }), - ) - .await - }) + .block_on(etcd_client::Client::connect( + endpoints, + tls_config.map(|tls_config| { + etcd_client::ConnectOptions::default().with_tls( + etcd_client::TlsOptions::new() + .domain_name(tls_config.domain_name) + .ca_certificate(etcd_client::Certificate::from_pem( + tls_config.ca_certificate, + )) + .identity(etcd_client::Identity::from_pem( + tls_config.identity_certificate, + tls_config.identity_private_key, + )), + ) + }), + )) .map_err(Self::etdc_to_tower_error)?; Ok(Self { From b51b9580e52f27708811426ba4647e46883a61cb Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:25:14 -0700 Subject: [PATCH 03/10] ledger-tool: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- ledger-tool/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index fdac269f4741bd..a6bdd0bfd70df4 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -1035,7 +1035,7 @@ fn hardforks_of(matches: &ArgMatches<'_>, name: &str) -> Option> { fn get_accounts_db_config(ledger_path: &Path, arg_matches: &ArgMatches<'_>) -> AccountsDbConfig { let accounts_index_bins = value_t!(arg_matches, "accounts_index_bins", usize).ok(); let accounts_index_index_limit_mb = - if let Some(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize).ok() { + if let Ok(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize) { IndexLimitMb::Limit(limit) } else if arg_matches.is_present("disable_accounts_disk_index") { IndexLimitMb::InMemOnly From e4f0f6842a5dd5dc480e38e953bb555d5c5f3103 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:25:36 -0700 Subject: [PATCH 04/10] ledger: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- ledger/src/bigtable_upload.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ledger/src/bigtable_upload.rs b/ledger/src/bigtable_upload.rs index 3db5f8eebbe863..7dce39ed8e292d 100644 --- a/ledger/src/bigtable_upload.rs +++ b/ledger/src/bigtable_upload.rs @@ -226,6 +226,10 @@ pub async fn upload_confirmed_blocks( } Some(confirmed_block) => { let bt = bigtable.clone(); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async + // move` block. But it captures `bt`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Some(tokio::spawn(async move { bt.upload_confirmed_block(slot, confirmed_block).await })) From 9de424e28cfac30381e05db3c3bfc6fd645cabf3 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:26:06 -0700 Subject: [PATCH 05/10] program-test: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- program-test/tests/fuzz.rs | 39 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/program-test/tests/fuzz.rs b/program-test/tests/fuzz.rs index 83bb603cc959cd..751fc18940c734 100644 --- a/program-test/tests/fuzz.rs +++ b/program-test/tests/fuzz.rs @@ -36,21 +36,17 @@ fn simulate_fuzz() { processor!(process_instruction), ); - let (mut banks_client, payer, last_blockhash) = - rt.block_on(async { program_test.start().await }); + let (mut banks_client, payer, last_blockhash) = rt.block_on(program_test.start()); // the honggfuzz `fuzz!` macro does not allow for async closures, // so we have to use the runtime directly to run async functions - rt.block_on(async { - run_fuzz_instructions( - &[1, 2, 3, 4, 5], - &mut banks_client, - &payer, - last_blockhash, - &program_id, - ) - .await - }); + rt.block_on(run_fuzz_instructions( + &[1, 2, 3, 4, 5], + &mut banks_client, + &payer, + last_blockhash, + &program_id, + )); } #[test] @@ -64,20 +60,17 @@ fn simulate_fuzz_with_context() { processor!(process_instruction), ); - let mut context = rt.block_on(async { program_test.start_with_context().await }); + let mut context = rt.block_on(program_test.start_with_context()); // the honggfuzz `fuzz!` macro does not allow for async closures, // so we have to use the runtime directly to run async functions - rt.block_on(async { - run_fuzz_instructions( - &[1, 2, 3, 4, 5], - &mut context.banks_client, - &context.payer, - context.last_blockhash, - &program_id, - ) - .await - }); + rt.block_on(run_fuzz_instructions( + &[1, 2, 3, 4, 5], + &mut context.banks_client, + &context.payer, + context.last_blockhash, + &program_id, + )); } async fn run_fuzz_instructions( From 15804c1cf9c0cacfac6442c56d5b74441562738e Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:26:39 -0700 Subject: [PATCH 06/10] quic-client: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- quic-client/src/quic_client.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quic-client/src/quic_client.rs b/quic-client/src/quic_client.rs index 39726deb1fd0a4..d25fffcd25716a 100644 --- a/quic-client/src/quic_client.rs +++ b/quic-client/src/quic_client.rs @@ -165,14 +165,14 @@ impl ClientConnection for QuicClientConnection { let _lock = ASYNC_TASK_SEMAPHORE.acquire(); let inner = self.inner.clone(); - let _handle = RUNTIME.spawn(async move { send_data_async(inner, data).await }); + let _handle = RUNTIME.spawn(send_data_async(inner, data)); Ok(()) } fn send_data_batch_async(&self, buffers: Vec>) -> TransportResult<()> { let _lock = ASYNC_TASK_SEMAPHORE.acquire(); let inner = self.inner.clone(); - let _handle = RUNTIME.spawn(async move { send_data_batch_async(inner, buffers).await }); + let _handle = RUNTIME.spawn(send_data_batch_async(inner, buffers)); Ok(()) } From 1ea3c04ab6788ab672c991a4c20903da6e36056f Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:27:26 -0700 Subject: [PATCH 07/10] rpc: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- rpc/src/rpc.rs | 112 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 86 insertions(+), 26 deletions(-) diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index 71de4f683d419a..cc8c2f3b0a4d3c 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -3505,6 +3505,10 @@ pub mod rpc_full { Err(err) => return Box::pin(future::err(err)), } } + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_signature_statuses(signatures, config).await }) } @@ -3805,6 +3809,10 @@ pub mod rpc_full { config: Option>, ) -> BoxFuture>> { debug!("get_block rpc request received: {:?}", slot); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_block(slot, config).await }) } @@ -3821,6 +3829,10 @@ pub mod rpc_full { "get_blocks rpc request received: {}-{:?}", start_slot, end_slot ); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_blocks(start_slot, end_slot, commitment.or(maybe_commitment)) .await @@ -3838,6 +3850,10 @@ pub mod rpc_full { "get_blocks_with_limit rpc request received: {}-{}", start_slot, limit, ); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_blocks_with_limit(start_slot, limit, commitment) .await @@ -3849,6 +3865,10 @@ pub mod rpc_full { meta: Self::Metadata, slot: Slot, ) -> BoxFuture>> { + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_block_time(slot).await }) } @@ -3863,6 +3883,10 @@ pub mod rpc_full { if let Err(err) = signature { return Box::pin(future::err(err)); } + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_transaction(signature.unwrap(), config).await }) } @@ -3884,24 +3908,34 @@ pub mod rpc_full { match verification { Err(err) => Box::pin(future::err(err)), - Ok((address, before, until, limit)) => Box::pin(async move { - meta.get_signatures_for_address( - address, - before, - until, - limit, - RpcContextConfig { - commitment, - min_context_slot, - }, - ) - .await - }), + Ok((address, before, until, limit)) => { + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this + // `async move` block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] + Box::pin(async move { + meta.get_signatures_for_address( + address, + before, + until, + limit, + RpcContextConfig { + commitment, + min_context_slot, + }, + ) + .await + }) + } } } fn get_first_available_block(&self, meta: Self::Metadata) -> BoxFuture> { debug!("get_first_available_block rpc request received"); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { Ok(meta.get_first_available_block().await) }) } @@ -3926,6 +3960,10 @@ pub mod rpc_full { } } + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_inflation_reward(addresses, config).await }) } @@ -4197,6 +4235,10 @@ pub mod rpc_deprecated_v1_7 { config: Option>, ) -> BoxFuture>> { debug!("get_confirmed_block rpc request received: {:?}", slot); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_block(slot, config.map(|config| config.convert())) .await @@ -4216,6 +4258,10 @@ pub mod rpc_deprecated_v1_7 { "get_confirmed_blocks rpc request received: {}-{:?}", start_slot, end_slot ); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_blocks(start_slot, end_slot, commitment.or(maybe_commitment)) .await @@ -4233,6 +4279,10 @@ pub mod rpc_deprecated_v1_7 { "get_confirmed_blocks_with_limit rpc request received: {}-{}", start_slot, limit, ); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_blocks_with_limit(start_slot, limit, commitment) .await @@ -4253,6 +4303,10 @@ pub mod rpc_deprecated_v1_7 { if let Err(err) = signature { return Box::pin(future::err(err)); } + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] Box::pin(async move { meta.get_transaction(signature.unwrap(), config.map(|config| config.convert())) .await @@ -4276,19 +4330,25 @@ pub mod rpc_deprecated_v1_7 { match verification { Err(err) => Box::pin(future::err(err)), - Ok((address, before, until, limit)) => Box::pin(async move { - meta.get_signatures_for_address( - address, - before, - until, - limit, - RpcContextConfig { - commitment, - min_context_slot: None, - }, - ) - .await - }), + Ok((address, before, until, limit)) => { + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this + // `async move` block. But it captures `meta`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] + Box::pin(async move { + meta.get_signatures_for_address( + address, + before, + until, + limit, + RpcContextConfig { + commitment, + min_context_slot: None, + }, + ) + .await + }) + } } } } From 81ddd1f482f6fc1af6424990e3427f142db61372 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:28:05 -0700 Subject: [PATCH 08/10] storage-bigtable: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- storage-bigtable/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/storage-bigtable/src/lib.rs b/storage-bigtable/src/lib.rs index 7bd821b348c800..ba72de9e9e4b3b 100644 --- a/storage-bigtable/src/lib.rs +++ b/storage-bigtable/src/lib.rs @@ -896,6 +896,10 @@ impl LedgerStorage { if !tx_cells.is_empty() { let conn = self.connection.clone(); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `tx_cells`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] tasks.push(tokio::spawn(async move { conn.put_bincode_cells_with_retry::("tx", &tx_cells) .await @@ -904,6 +908,10 @@ impl LedgerStorage { if !tx_by_addr_cells.is_empty() { let conn = self.connection.clone(); + // clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async move` + // block. But it captures `tx_by_addr_cells`, so it is necessary. + // TODO Enable after upgrade to Rust 1.69. + // #[allow(clippy::redundant_async_block)] tasks.push(tokio::spawn(async move { conn.put_protobuf_cells_with_retry::( "tx-by-addr", From 1410ae5c259f22fa418092e393a6ef61a450ace2 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:28:10 -0700 Subject: [PATCH 09/10] tpu-client: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- tpu-client/src/nonblocking/tpu_client.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tpu-client/src/nonblocking/tpu_client.rs b/tpu-client/src/nonblocking/tpu_client.rs index a94f954e39435c..303a2ad188e358 100644 --- a/tpu-client/src/nonblocking/tpu_client.rs +++ b/tpu-client/src/nonblocking/tpu_client.rs @@ -616,16 +616,13 @@ impl LeaderTpuService { let t_leader_tpu_service = Some({ let recent_slots = recent_slots.clone(); let leader_tpu_cache = leader_tpu_cache.clone(); - tokio::spawn(async move { - Self::run( - rpc_client, - recent_slots, - leader_tpu_cache, - pubsub_client, - exit, - ) - .await - }) + tokio::spawn(Self::run( + rpc_client, + recent_slots, + leader_tpu_cache, + pubsub_client, + exit, + )) }); Ok(LeaderTpuService { From 79c6840a839b70f36a248527ead86f1bc1bb5f61 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 20 Mar 2023 17:28:15 -0700 Subject: [PATCH 10/10] validator: clippy 0.1.70: 2023-03-18: Apply suggestions, disable false positives --- validator/src/main.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/validator/src/main.rs b/validator/src/main.rs index 744396f91b490c..ba1c9bf26e8939 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -462,8 +462,8 @@ pub fn main() { ("authorized-voter", Some(authorized_voter_subcommand_matches)) => { match authorized_voter_subcommand_matches.subcommand() { ("add", Some(subcommand_matches)) => { - if let Some(authorized_voter_keypair) = - value_t!(subcommand_matches, "authorized_voter_keypair", String).ok() + if let Ok(authorized_voter_keypair) = + value_t!(subcommand_matches, "authorized_voter_keypair", String) { let authorized_voter_keypair = fs::canonicalize(&authorized_voter_keypair) .unwrap_or_else(|err| { @@ -558,7 +558,7 @@ pub fn main() { return; } ("unload", Some(subcommand_matches)) => { - if let Some(name) = value_t!(subcommand_matches, "name", String).ok() { + if let Ok(name) = value_t!(subcommand_matches, "name", String) { let admin_client = admin_rpc_service::connect(&ledger_path); admin_rpc_service::runtime() .block_on(async { @@ -573,7 +573,7 @@ pub fn main() { return; } ("load", Some(subcommand_matches)) => { - if let Some(config) = value_t!(subcommand_matches, "config", String).ok() { + if let Ok(config) = value_t!(subcommand_matches, "config", String) { let admin_client = admin_rpc_service::connect(&ledger_path); let name = admin_rpc_service::runtime() .block_on(async { @@ -588,8 +588,8 @@ pub fn main() { return; } ("reload", Some(subcommand_matches)) => { - if let Some(name) = value_t!(subcommand_matches, "name", String).ok() { - if let Some(config) = value_t!(subcommand_matches, "config", String).ok() { + if let Ok(name) = value_t!(subcommand_matches, "name", String) { + if let Ok(config) = value_t!(subcommand_matches, "config", String) { let admin_client = admin_rpc_service::connect(&ledger_path); admin_rpc_service::runtime() .block_on(async { @@ -698,7 +698,7 @@ pub fn main() { ("set-identity", Some(subcommand_matches)) => { let require_tower = subcommand_matches.is_present("require_tower"); - if let Some(identity_keypair) = value_t!(subcommand_matches, "identity", String).ok() { + if let Ok(identity_keypair) = value_t!(subcommand_matches, "identity", String) { let identity_keypair = fs::canonicalize(&identity_keypair).unwrap_or_else(|err| { println!("Unable to access path: {identity_keypair}: {err:?}"); exit(1); @@ -1075,12 +1075,12 @@ pub fn main() { started_from_validator: true, // this is the only place this is set ..AccountsIndexConfig::default() }; - if let Some(bins) = value_t!(matches, "accounts_index_bins", usize).ok() { + if let Ok(bins) = value_t!(matches, "accounts_index_bins", usize) { accounts_index_config.bins = Some(bins); } accounts_index_config.index_limit_mb = - if let Some(limit) = value_t!(matches, "accounts_index_memory_limit_mb", usize).ok() { + if let Ok(limit) = value_t!(matches, "accounts_index_memory_limit_mb", usize) { IndexLimitMb::Limit(limit) } else if matches.is_present("disable_accounts_disk_index") { IndexLimitMb::InMemOnly