simplify heap_iter.rs
This commit is contained in:
@@ -167,9 +167,7 @@ impl<HeapCellIter> Iterator for HeapCellAcyclicIterator<HeapCellIter>
|
|||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
while let Some(addr) = self.iter.stack().pop() {
|
while let Some(addr) = self.iter.stack().pop() {
|
||||||
if self.seen.contains(&addr) {
|
if !self.seen.contains(&addr) {
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
self.iter.stack().push(addr.clone());
|
self.iter.stack().push(addr.clone());
|
||||||
self.seen.insert(addr);
|
self.seen.insert(addr);
|
||||||
break;
|
break;
|
||||||
@@ -201,9 +199,7 @@ impl<HeapCellIter> Iterator for HeapCellZippedAcyclicIterator<HeapCellIter>
|
|||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
while let (Some(a1), Some(a2)) = (self.i1.stack().pop(), self.i2.stack().pop()) {
|
while let (Some(a1), Some(a2)) = (self.i1.stack().pop(), self.i2.stack().pop()) {
|
||||||
if self.seen.contains(&(a1.clone(), a2.clone())) {
|
if !self.seen.contains(&(a1.clone(), a2.clone())) {
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
self.i1.stack().push(a1.clone());
|
self.i1.stack().push(a1.clone());
|
||||||
self.i2.stack().push(a2.clone());
|
self.i2.stack().push(a2.clone());
|
||||||
self.seen.insert((a1, a2));
|
self.seen.insert((a1, a2));
|
||||||
|
|||||||
Reference in New Issue
Block a user