need_more -> ready

This commit is contained in:
Noah Hellman 2022-12-11 11:12:17 +01:00
parent e798dc9c28
commit 463f146623

View file

@ -323,7 +323,7 @@ impl<'s> Iterator for Parser<'s> {
type Item = Event; type Item = Event;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
let mut need_more = false; let mut ready = true;
while self.events.is_empty() while self.events.is_empty()
|| !self.openers.is_empty() || !self.openers.is_empty()
|| !matches!(self.state, State::None) || !matches!(self.state, State::None)
@ -336,12 +336,12 @@ impl<'s> Iterator for Parser<'s> {
self.events.push_back(ev); self.events.push_back(ev);
dbg!(&self.events, &self.state); dbg!(&self.events, &self.state);
} else { } else {
need_more = true; ready = false;
break; break;
} }
} }
if self.last || !need_more { if self.last || ready {
self.events self.events
.pop_front() .pop_front()
.map(|e| { .map(|e| {