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

clippy: Replace if let Some() = res.ok() with if let Ok() = res #31525

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ledger-tool/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn get_accounts_db_config(
) -> 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
Expand Down
18 changes: 9 additions & 9 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,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| {
Expand Down Expand Up @@ -562,7 +562,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 {
Expand All @@ -577,7 +577,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 {
Expand All @@ -592,8 +592,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 {
Expand Down Expand Up @@ -702,7 +702,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);
Expand Down Expand Up @@ -1115,12 +1115,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
Expand Down