Skip to content

Commit 7bb83a3

Browse files
authored
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.
1 parent c3e513c commit 7bb83a3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/checker.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,7 @@ impl<'a, F: Function> Checker<'a, F> {
10011001
queue_set.insert(block);
10021002
}
10031003

1004-
while !queue.is_empty() {
1005-
let block = queue.pop().unwrap();
1004+
while let Some(block) = queue.pop() {
10061005
queue_set.remove(&block);
10071006
let mut state = self.bb_in.get(&block).cloned().unwrap();
10081007
trace!("analyze: block {} has state {:?}", block.index(), state);
@@ -1043,9 +1042,8 @@ impl<'a, F: Function> Checker<'a, F> {
10431042
new_state
10441043
);
10451044
self.bb_in.insert(succ, new_state);
1046-
if !queue_set.contains(&succ) {
1045+
if queue_set.insert(succ) {
10471046
queue.push(succ);
1048-
queue_set.insert(succ);
10491047
}
10501048
}
10511049
}

0 commit comments

Comments
 (0)