Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 7ddf94b

Browse files
committed
clippy: Replace if let Some() = res.ok() with if let Ok() = res
1 parent 775639c commit 7ddf94b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ledger-tool/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn get_accounts_db_config(
1818
) -> AccountsDbConfig {
1919
let accounts_index_bins = value_t!(arg_matches, "accounts_index_bins", usize).ok();
2020
let accounts_index_index_limit_mb =
21-
if let Some(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize).ok() {
21+
if let Ok(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize) {
2222
IndexLimitMb::Limit(limit)
2323
} else if arg_matches.is_present("disable_accounts_disk_index") {
2424
IndexLimitMb::InMemOnly

validator/src/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ pub fn main() {
466466
("authorized-voter", Some(authorized_voter_subcommand_matches)) => {
467467
match authorized_voter_subcommand_matches.subcommand() {
468468
("add", Some(subcommand_matches)) => {
469-
if let Some(authorized_voter_keypair) =
470-
value_t!(subcommand_matches, "authorized_voter_keypair", String).ok()
469+
if let Ok(authorized_voter_keypair) =
470+
value_t!(subcommand_matches, "authorized_voter_keypair", String)
471471
{
472472
let authorized_voter_keypair = fs::canonicalize(&authorized_voter_keypair)
473473
.unwrap_or_else(|err| {
@@ -562,7 +562,7 @@ pub fn main() {
562562
return;
563563
}
564564
("unload", Some(subcommand_matches)) => {
565-
if let Some(name) = value_t!(subcommand_matches, "name", String).ok() {
565+
if let Ok(name) = value_t!(subcommand_matches, "name", String) {
566566
let admin_client = admin_rpc_service::connect(&ledger_path);
567567
admin_rpc_service::runtime()
568568
.block_on(async {
@@ -577,7 +577,7 @@ pub fn main() {
577577
return;
578578
}
579579
("load", Some(subcommand_matches)) => {
580-
if let Some(config) = value_t!(subcommand_matches, "config", String).ok() {
580+
if let Ok(config) = value_t!(subcommand_matches, "config", String) {
581581
let admin_client = admin_rpc_service::connect(&ledger_path);
582582
let name = admin_rpc_service::runtime()
583583
.block_on(async {
@@ -592,8 +592,8 @@ pub fn main() {
592592
return;
593593
}
594594
("reload", Some(subcommand_matches)) => {
595-
if let Some(name) = value_t!(subcommand_matches, "name", String).ok() {
596-
if let Some(config) = value_t!(subcommand_matches, "config", String).ok() {
595+
if let Ok(name) = value_t!(subcommand_matches, "name", String) {
596+
if let Ok(config) = value_t!(subcommand_matches, "config", String) {
597597
let admin_client = admin_rpc_service::connect(&ledger_path);
598598
admin_rpc_service::runtime()
599599
.block_on(async {
@@ -702,7 +702,7 @@ pub fn main() {
702702
("set-identity", Some(subcommand_matches)) => {
703703
let require_tower = subcommand_matches.is_present("require_tower");
704704

705-
if let Some(identity_keypair) = value_t!(subcommand_matches, "identity", String).ok() {
705+
if let Ok(identity_keypair) = value_t!(subcommand_matches, "identity", String) {
706706
let identity_keypair = fs::canonicalize(&identity_keypair).unwrap_or_else(|err| {
707707
println!("Unable to access path: {identity_keypair}: {err:?}");
708708
exit(1);
@@ -1115,12 +1115,12 @@ pub fn main() {
11151115
started_from_validator: true, // this is the only place this is set
11161116
..AccountsIndexConfig::default()
11171117
};
1118-
if let Some(bins) = value_t!(matches, "accounts_index_bins", usize).ok() {
1118+
if let Ok(bins) = value_t!(matches, "accounts_index_bins", usize) {
11191119
accounts_index_config.bins = Some(bins);
11201120
}
11211121

11221122
accounts_index_config.index_limit_mb =
1123-
if let Some(limit) = value_t!(matches, "accounts_index_memory_limit_mb", usize).ok() {
1123+
if let Ok(limit) = value_t!(matches, "accounts_index_memory_limit_mb", usize) {
11241124
IndexLimitMb::Limit(limit)
11251125
} else if matches.is_present("disable_accounts_disk_index") {
11261126
IndexLimitMb::InMemOnly

0 commit comments

Comments
 (0)