Uses while-let (#32479)
This commit is contained in:
parent
3c825f28a5
commit
60130fdd75
|
@ -356,8 +356,7 @@ impl HeaviestSubtreeForkChoice {
|
|||
let mut tree_root = None;
|
||||
// Find the subtrees to prune
|
||||
let mut to_visit = vec![self.tree_root];
|
||||
while !to_visit.is_empty() {
|
||||
let cur_slot = to_visit.pop().unwrap();
|
||||
while let Some(cur_slot) = to_visit.pop() {
|
||||
if cur_slot == new_root {
|
||||
tree_root = Some(new_root);
|
||||
continue;
|
||||
|
@ -532,8 +531,7 @@ impl HeaviestSubtreeForkChoice {
|
|||
let mut split_tree_fork_infos = HashMap::new();
|
||||
let mut to_visit = vec![*slot_hash_key];
|
||||
|
||||
while !to_visit.is_empty() {
|
||||
let current_node = to_visit.pop().unwrap();
|
||||
while let Some(current_node) = to_visit.pop() {
|
||||
let current_fork_info = self
|
||||
.fork_infos
|
||||
.remove(¤t_node)
|
||||
|
|
|
@ -15,8 +15,7 @@ pub trait TreeDiff<'a> {
|
|||
}
|
||||
let mut pending_keys = vec![root1];
|
||||
let mut reachable_set = HashSet::new();
|
||||
while !pending_keys.is_empty() {
|
||||
let current_key = pending_keys.pop().unwrap();
|
||||
while let Some(current_key) = pending_keys.pop() {
|
||||
if current_key == root2 {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -112,8 +112,7 @@ impl<'a> Iterator for ValidatorGossipVotesIterator<'a> {
|
|||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
use SingleValidatorVotes::*;
|
||||
while !self.vote_account_keys.is_empty() {
|
||||
let vote_account_key = self.vote_account_keys.pop().unwrap();
|
||||
while let Some(vote_account_key) = self.vote_account_keys.pop() {
|
||||
// Get all the gossip votes we've queued up for this validator
|
||||
// that are:
|
||||
// 1) missing from the current leader bank
|
||||
|
|
|
@ -184,8 +184,7 @@ pub fn verify_ledger_ticks(ledger_path: &Path, ticks_per_slot: usize) {
|
|||
.into_iter()
|
||||
.map(|slot| (slot, 0, last_id))
|
||||
.collect();
|
||||
while !pending_slots.is_empty() {
|
||||
let (slot, parent_slot, last_id) = pending_slots.pop().unwrap();
|
||||
while let Some((slot, parent_slot, last_id)) = pending_slots.pop() {
|
||||
let next_slots = ledger
|
||||
.get_slots_since(&[slot])
|
||||
.unwrap()
|
||||
|
|
Loading…
Reference in New Issue