Skip to content

Commit

Permalink
hashglobe: Use ? on Option more often.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Dec 9, 2017
1 parent 339d633 commit 6c37edf
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions components/hashglobe/src/hash_set.rs
Expand Up @@ -1051,13 +1051,9 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S>

fn next(&mut self) -> Option<&'a T> {
loop {
match self.iter.next() {
None => return None,
Some(elt) => {
if self.other.contains(elt) {
return Some(elt);
}
}
let elt = self.iter.next()?;
if self.other.contains(elt) {
return Some(elt);
}
}
}
Expand Down Expand Up @@ -1091,13 +1087,9 @@ impl<'a, T, S> Iterator for Difference<'a, T, S>

fn next(&mut self) -> Option<&'a T> {
loop {
match self.iter.next() {
None => return None,
Some(elt) => {
if !self.other.contains(elt) {
return Some(elt);
}
}
let elt = self.iter.next()?;
if !self.other.contains(elt) {
return Some(elt);
}
}
}
Expand Down

0 comments on commit 6c37edf

Please sign in to comment.