checker: Use a couple of Rust idioms (#114)

This should have no functional change, just makes the source slightly
easier to read and reason about.
This commit is contained in:
Jamey Sharp
2023-02-15 17:59:20 -08:00
committed by GitHub
parent c3e513c4cb
commit 7bb83a3361

View File

@@ -1001,8 +1001,7 @@ impl<'a, F: Function> Checker<'a, F> {
queue_set.insert(block);
}
while !queue.is_empty() {
let block = queue.pop().unwrap();
while let Some(block) = queue.pop() {
queue_set.remove(&block);
let mut state = self.bb_in.get(&block).cloned().unwrap();
trace!("analyze: block {} has state {:?}", block.index(), state);
@@ -1043,9 +1042,8 @@ impl<'a, F: Function> Checker<'a, F> {
new_state
);
self.bb_in.insert(succ, new_state);
if !queue_set.contains(&succ) {
if queue_set.insert(succ) {
queue.push(succ);
queue_set.insert(succ);
}
}
}