Context: scryer-prolog/iterators.rs at l0_final · mthom/scryer-prolog · GitHub
impl<'a> Iterator for BreadthFirstIterator<'a> {
type Item = &'a Term;
fn next(&mut self) -> Option<Self::Item> {
if let Some(term) = self.state_queue.pop_front() {
if let &Term::Clause(_, _, ref child_terms) = term {
for term in child_terms {
self.state_queue.push_back(term);
}
return Some(term); // <-- THIS LINE
}
return Some(term);
}
None
}
}
Can THIS LINE
be safely removed ? Intuitively, I think yes, but I am trying to figure out if there is some Rust / Prolog / WAM black magic that is throwing me off.