Skip to content

Commit

Permalink
clippy: #[warn(clippy::single_match)] (anza-xyz#3218)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Oct 18, 2024
1 parent df97398 commit 5535e79
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 31 deletions.
7 changes: 2 additions & 5 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6321,11 +6321,8 @@ impl AccountsDb {
.unzip();

// hash this accounts in bg
match &self.sender_bg_hasher {
Some(ref sender) => {
let _ = sender.send(cached_accounts);
}
None => (),
if let Some(ref sender) = &self.sender_bg_hasher {
let _ = sender.send(cached_accounts);
};

account_infos
Expand Down
9 changes: 3 additions & 6 deletions accounts-db/src/hardened_unpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,10 @@ where
|parts, kind| {
if is_valid_snapshot_archive_entry(parts, kind) {
i += 1;
match &parallel_selector {
Some(parallel_selector) => {
if !parallel_selector.select_index(i - 1) {
return UnpackPath::Ignore;
}
if let Some(parallel_selector) = &parallel_selector {
if !parallel_selector.select_index(i - 1) {
return UnpackPath::Ignore;
}
None => {}
};
if let ["accounts", file] = parts {
// Randomly distribute the accounts files about the available `account_paths`,
Expand Down
7 changes: 3 additions & 4 deletions core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,11 @@ impl ClusterInfoVoteListener {
gossip_vote_slot_confirming_time.stop();
let gossip_vote_slot_confirming_time_us = gossip_vote_slot_confirming_time.as_us();

match vote_processing_time {
Some(ref mut vote_processing_time) => vote_processing_time.update(
if let Some(ref mut vote_processing_time) = vote_processing_time {
vote_processing_time.update(
gossip_vote_txn_processing_time_us,
gossip_vote_slot_confirming_time_us,
),
None => {}
)
}
new_optimistic_confirmed_slots
}
Expand Down
26 changes: 10 additions & 16 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3916,14 +3916,11 @@ impl Bank {
) {
let mut fees = 0;

processing_results
.iter()
.for_each(|processing_result| match processing_result {
Ok(processed_tx) => {
fees += processed_tx.fee_details().total_fee();
}
Err(_) => {}
});
processing_results.iter().for_each(|processing_result| {
if let Ok(processed_tx) = processing_result {
fees += processed_tx.fee_details().total_fee();
}
});

self.collector_fees.fetch_add(fees, Relaxed);
}
Expand All @@ -3935,14 +3932,11 @@ impl Bank {
) {
let mut accumulated_fee_details = FeeDetails::default();

processing_results
.iter()
.for_each(|processing_result| match processing_result {
Ok(processed_tx) => {
accumulated_fee_details.accumulate(&processed_tx.fee_details());
}
Err(_) => {}
});
processing_results.iter().for_each(|processing_result| {
if let Ok(processed_tx) = processing_result {
accumulated_fee_details.accumulate(&processed_tx.fee_details());
}
});

self.collector_fee_details
.write()
Expand Down

0 comments on commit 5535e79

Please sign in to comment.