From df1825c63b7919c8f3835884a936dc1bcea649b5 Mon Sep 17 00:00:00 2001 From: Arrowana Date: Fri, 20 Oct 2023 21:05:20 +1100 Subject: [PATCH] CLI remove unwrap_or_default() on rpc calls --- cli/src/cluster_query.rs | 26 ++++++++++---------------- cli/src/feature.rs | 3 +-- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index 0470cf761ad95d..ee683081ed4790 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -1886,23 +1886,17 @@ pub fn process_show_validators( progress_bar.set_message("Fetching block production..."); let skip_rate: HashMap<_, _> = rpc_client - .get_block_production() - .ok() - .map(|result| { - result - .value - .by_identity - .into_iter() - .map(|(identity, (leader_slots, blocks_produced))| { - ( - identity, - 100. * (leader_slots.saturating_sub(blocks_produced)) as f64 - / leader_slots as f64, - ) - }) - .collect() + .get_block_production()? + .value + .by_identity + .into_iter() + .map(|(identity, (leader_slots, blocks_produced))| { + ( + identity, + 100. * (leader_slots.saturating_sub(blocks_produced)) as f64 / leader_slots as f64, + ) }) - .unwrap_or_default(); + .collect(); progress_bar.set_message("Fetching version information..."); let mut node_version = HashMap::new(); diff --git a/cli/src/feature.rs b/cli/src/feature.rs index d55f3dee88a7d0..708ea302b9ac27 100644 --- a/cli/src/feature.rs +++ b/cli/src/feature.rs @@ -854,8 +854,7 @@ fn process_status( let mut features = vec![]; for feature_ids in feature_ids.chunks(MAX_MULTIPLE_ACCOUNTS) { let mut feature_chunk = rpc_client - .get_multiple_accounts(feature_ids) - .unwrap_or_default() + .get_multiple_accounts(feature_ids)? .into_iter() .zip(feature_ids) .map(|(account, feature_id)| {