selectors: Simplify SelectorIter::next.

This commit is contained in:
Emilio Cobos Álvarez 2018-01-18 23:50:03 +01:00
parent 671b69c0b7
commit bbe7ff86da
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -609,13 +609,12 @@ impl<'a, Impl: SelectorImpl> Iterator for SelectorIter<'a, Impl> {
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
debug_assert!(self.next_combinator.is_none(), debug_assert!(self.next_combinator.is_none(),
"You should call next_sequence!"); "You should call next_sequence!");
match self.iter.next() { match *self.iter.next()? {
None => None, Component::Combinator(c) => {
Some(&Component::Combinator(c)) => {
self.next_combinator = Some(c); self.next_combinator = Some(c);
None None
}, },
Some(x) => Some(x), ref x => Some(x),
} }
} }
} }