diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-02-18 18:10:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-18 18:10:13 +0100 |
| commit | 33d13465885580342aca5c82477d0933806ec479 (patch) | |
| tree | 87ef8db1fa3466cb22853b096806f5a09447db3f | |
| parent | e4c285d1ac93b110acb559b7906d3b12cdc9d9b2 (diff) | |
| parent | 860900cfc348e0579eac3acb07097161306d7908 (diff) | |
| download | rust-33d13465885580342aca5c82477d0933806ec479.tar.gz rust-33d13465885580342aca5c82477d0933806ec479.zip | |
Rollup merge of #39898 - king6cong:logic_clean, r=alexcrichton
code order tweak
| -rw-r--r-- | src/libcore/iter/iterator.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index d41767cce18..3785bbe9bb0 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -1603,12 +1603,12 @@ pub trait Iterator { let mut i = self.len(); while let Some(v) = self.next_back() { - if predicate(v) { - return Some(i - 1); - } // No need for an overflow check here, because `ExactSizeIterator` // implies that the number of elements fits into a `usize`. i -= 1; + if predicate(v) { + return Some(i); + } } None } |
