Skip to content

Commit

Permalink
Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
michirakara committed Sep 26, 2024
1 parent 0cdca2c commit 7b3dc62
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/core/src/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,11 @@ impl<A: Step> Iterator for ops::Range<A> {

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
Step::steps_between(&self.start, &self.end)
if self.start < self.end {
(0, Some(0));
} else {
Step::steps_between(&self.start, &self.end)
}
}

#[inline]
Expand Down

0 comments on commit 7b3dc62

Please sign in to comment.