code order tweak

This commit is contained in:
king6cong 2017-02-17 09:47:37 +08:00
parent 668864d9ed
commit 860900cfc3

View File

@ -1603,12 +1603,12 @@ fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where
let mut i = self.len(); let mut i = self.len();
while let Some(v) = self.next_back() { while let Some(v) = self.next_back() {
if predicate(v) {
return Some(i - 1);
}
// No need for an overflow check here, because `ExactSizeIterator` // No need for an overflow check here, because `ExactSizeIterator`
// implies that the number of elements fits into a `usize`. // implies that the number of elements fits into a `usize`.
i -= 1; i -= 1;
if predicate(v) {
return Some(i);
}
} }
None None
} }