Replace some Option matching with higher order methods

This shrinks the code and should be easier to read if we are used to the
idioms.

Also change one copy to clone() while we're here.
This commit is contained in:
Keegan McAllister 2013-07-25 14:57:01 -07:00
parent bb51a9d6fb
commit c047a4b436
8 changed files with 24 additions and 55 deletions

View file

@ -415,10 +415,7 @@ impl<'self, View> AbstractNode<View> {
impl<View> Iterator<AbstractNode<View>> for AbstractNodeChildrenIterator<View> {
pub fn next(&mut self) -> Option<AbstractNode<View>> {
let node = self.current_node;
self.current_node = match self.current_node {
None => None,
Some(node) => node.next_sibling(),
};
self.current_node = self.current_node.chain(|node| node.next_sibling());
node
}
}