Simplify CxxVector iterator next method

This commit is contained in:
David Tolnay 2020-12-21 17:35:24 -08:00
parent cbf0964a7c
commit 0d52717355
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -158,9 +158,9 @@ where
type Item = &'a T;
fn next(&mut self) -> Option<Self::Item> {
let next = self.v.get(self.index);
self.index += next.is_some() as usize;
next
let next = self.v.get(self.index)?;
self.index += 1;
Some(next)
}
fn size_hint(&self) -> (usize, Option<usize>) {