Skip to content

Commit 33d1346

Browse files
Rollup merge of #39898 - king6cong:logic_clean, r=alexcrichton
code order tweak
2 parents e4c285d + 860900c commit 33d1346

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libcore/iter/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1603,12 +1603,12 @@ pub trait Iterator {
16031603
let mut i = self.len();
16041604

16051605
while let Some(v) = self.next_back() {
1606-
if predicate(v) {
1607-
return Some(i - 1);
1608-
}
16091606
// No need for an overflow check here, because `ExactSizeIterator`
16101607
// implies that the number of elements fits into a `usize`.
16111608
i -= 1;
1609+
if predicate(v) {
1610+
return Some(i);
1611+
}
16121612
}
16131613
None
16141614
}

0 commit comments

Comments
 (0)