Skip to content

Commit

Permalink
Apply suggestion: use match
Browse files Browse the repository at this point in the history
  • Loading branch information
a1phyr committed Nov 8, 2023
1 parent 83273fb commit 5aa1b77
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1862,8 +1862,10 @@ impl<'a, T> Iterator for Iter<'a, T> {

fn next(&mut self) -> Option<Self::Item> {
// Avoid `Option::map` because it bloats LLVM IR.
let bucket = self.inner.next()?;
Some(unsafe { bucket.as_ref() })
match self.inner.next() {
Some(bucket) => Some(unsafe { bucket.as_ref() }),
None => None,
}
}

fn size_hint(&self) -> (usize, Option<usize>) {
Expand Down Expand Up @@ -1906,8 +1908,10 @@ impl<'a, T> Iterator for IterMut<'a, T> {

fn next(&mut self) -> Option<Self::Item> {
// Avoid `Option::map` because it bloats LLVM IR.
let bucket = self.inner.next()?;
Some(unsafe { bucket.as_mut() })
match self.inner.next() {
Some(bucket) => Some(unsafe { bucket.as_mut() }),
None => None,
}
}

fn size_hint(&self) -> (usize, Option<usize>) {
Expand Down

0 comments on commit 5aa1b77

Please sign in to comment.