diff --git a/car-mirror/src/dag_walk.rs b/car-mirror/src/dag_walk.rs index 25238ca..045d0ec 100644 --- a/car-mirror/src/dag_walk.rs +++ b/car-mirror/src/dag_walk.rs @@ -75,14 +75,10 @@ impl DagWalk { fn frontier_next(&mut self) -> Option { loop { - let popped = if self.breadth_first { - self.frontier.pop_back() + let cid = if self.breadth_first { + self.frontier.pop_back()? } else { - self.frontier.pop_front() - }; - - let Some(cid) = popped else { - return None; + self.frontier.pop_front()? }; // We loop until we find an unvisited block