We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6ed7413 + 860900c commit aedaa98Copy full SHA for aedaa98
src/libcore/iter/iterator.rs
@@ -1603,12 +1603,12 @@ pub trait Iterator {
1603
let mut i = self.len();
1604
1605
while let Some(v) = self.next_back() {
1606
- if predicate(v) {
1607
- return Some(i - 1);
1608
- }
1609
// No need for an overflow check here, because `ExactSizeIterator`
1610
// implies that the number of elements fits into a `usize`.
1611
i -= 1;
+ if predicate(v) {
+ return Some(i);
+ }
1612
}
1613
None
1614
0 commit comments