File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: {
2
2
intrinsics,
3
3
iter:: { from_fn, TrustedLen , TrustedRandomAccess } ,
4
- num:: NonZeroUsize ,
4
+ num:: NonZero ,
5
5
ops:: { Range , Try } ,
6
6
} ;
7
7
@@ -42,10 +42,10 @@ impl<I> StepBy<I> {
42
42
/// The `step` that was originally passed to `Iterator::step_by(step)`,
43
43
/// aka `self.step_minus_one + 1`.
44
44
#[ inline]
45
- fn original_step ( & self ) -> NonZeroUsize {
45
+ fn original_step ( & self ) -> NonZero < usize > {
46
46
// SAFETY: By type invariant, `step_minus_one` cannot be `MAX`, which
47
47
// means the addition cannot overflow and the result cannot be zero.
48
- unsafe { NonZeroUsize :: new_unchecked ( intrinsics:: unchecked_add ( self . step_minus_one , 1 ) ) }
48
+ unsafe { NonZero :: new_unchecked ( intrinsics:: unchecked_add ( self . step_minus_one , 1 ) ) }
49
49
}
50
50
}
51
51
@@ -231,12 +231,12 @@ unsafe impl<I: Iterator> StepByImpl<I> for StepBy<I> {
231
231
#[ inline]
232
232
default fn spec_size_hint ( & self ) -> ( usize , Option < usize > ) {
233
233
#[ inline]
234
- fn first_size ( step : NonZeroUsize ) -> impl Fn ( usize ) -> usize {
234
+ fn first_size ( step : NonZero < usize > ) -> impl Fn ( usize ) -> usize {
235
235
move |n| if n == 0 { 0 } else { 1 + ( n - 1 ) / step }
236
236
}
237
237
238
238
#[ inline]
239
- fn other_size ( step : NonZeroUsize ) -> impl Fn ( usize ) -> usize {
239
+ fn other_size ( step : NonZero < usize > ) -> impl Fn ( usize ) -> usize {
240
240
move |n| n / step
241
241
}
242
242
You can’t perform that action at this time.
0 commit comments