Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
michirakara committed Nov 7, 2024
1 parent 45ff5d1 commit 48ec542
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ macro_rules! step_integer_impls {
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
if *start <= *end {
// This relies on $u_narrower <= usize
let steps = (*end - *start) as usize
let steps = (*end - *start) as usize;
(steps, Some(steps))
} else {
(0, None)
Expand Down Expand Up @@ -788,7 +788,7 @@ impl<T: TrustedStep> RangeIteratorImpl for ops::Range<T> {
#[inline]
fn spec_advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>> {
let steps = Step::steps_between(&self.start, &self.end);
let available = steps.1.unwrap_or(step.0);
let available = steps.1.unwrap_or(steps.0);

let taken = available.min(n);

Expand Down

0 comments on commit 48ec542

Please sign in to comment.