Skip to content

Commit aedaa98

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

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libcore/iter/iterator.rs

Lines changed: 3 additions & 3 deletions
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)