@@ -196,9 +196,6 @@ macro_rules! step_identical_methods {
196
196
unsafe fn backward_unchecked( start: Self , n: usize ) -> Self {
197
197
start. unchecked_sub( n as Self )
198
198
}
199
- } ;
200
- ( [ $u: ident $i: ident] ) => {
201
- step_identical_methods!( ) ;
202
199
203
200
#[ inline]
204
201
fn forward( start: Self , n: usize ) -> Self {
@@ -207,8 +204,8 @@ macro_rules! step_identical_methods {
207
204
if Self :: forward_checked( start, n) . is_none( ) {
208
205
let _ = Add :: add( Self :: MAX , 1 ) ;
209
206
}
210
- // Do wrapping math to allow e.g. `Step::forward(-128u8 , 255)`.
211
- start. wrapping_add( n as Self ) as Self
207
+ // Do wrapping math to allow e.g. `Step::forward(-128i8 , 255)`.
208
+ start. wrapping_add( n as Self )
212
209
}
213
210
214
211
#[ inline]
@@ -218,8 +215,8 @@ macro_rules! step_identical_methods {
218
215
if Self :: backward_checked( start, n) . is_none( ) {
219
216
let _ = Sub :: sub( Self :: MIN , 1 ) ;
220
217
}
221
- // Do wrapping math to allow e.g. `Step::backward(127u8 , 255)`.
222
- start. wrapping_sub( n as Self ) as Self
218
+ // Do wrapping math to allow e.g. `Step::backward(127i8 , 255)`.
219
+ start. wrapping_sub( n as Self )
223
220
}
224
221
} ;
225
222
}
@@ -235,7 +232,7 @@ macro_rules! step_integer_impls {
235
232
#[ allow( unreachable_patterns) ]
236
233
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
237
234
unsafe impl Step for $u_narrower {
238
- step_identical_methods!( [ $u_narrower $i_narrower ] ) ;
235
+ step_identical_methods!( ) ;
239
236
240
237
#[ inline]
241
238
fn steps_between( start: & Self , end: & Self ) -> Option <usize > {
@@ -267,7 +264,7 @@ macro_rules! step_integer_impls {
267
264
#[ allow( unreachable_patterns) ]
268
265
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
269
266
unsafe impl Step for $i_narrower {
270
- step_identical_methods!( [ $u_narrower $i_narrower ] ) ;
267
+ step_identical_methods!( ) ;
271
268
272
269
#[ inline]
273
270
fn steps_between( start: & Self , end: & Self ) -> Option <usize > {
@@ -347,20 +344,10 @@ macro_rules! step_integer_impls {
347
344
start. checked_add( n as Self )
348
345
}
349
346
350
- #[ inline]
351
- fn forward( start: Self , n: usize ) -> Self {
352
- Add :: add( start, n as Self )
353
- }
354
-
355
347
#[ inline]
356
348
fn backward_checked( start: Self , n: usize ) -> Option <Self > {
357
349
start. checked_sub( n as Self )
358
350
}
359
-
360
- #[ inline]
361
- fn backward( start: Self , n: usize ) -> Self {
362
- Sub :: sub( start, n as Self )
363
- }
364
351
}
365
352
366
353
#[ allow( unreachable_patterns) ]
@@ -387,20 +374,10 @@ macro_rules! step_integer_impls {
387
374
start. checked_add( n as Self )
388
375
}
389
376
390
- #[ inline]
391
- fn forward( start: Self , n: usize ) -> Self {
392
- Add :: add( start, n as Self )
393
- }
394
-
395
377
#[ inline]
396
378
fn backward_checked( start: Self , n: usize ) -> Option <Self > {
397
379
start. checked_sub( n as Self )
398
380
}
399
-
400
- #[ inline]
401
- fn backward( start: Self , n: usize ) -> Self {
402
- Sub :: sub( start, n as Self )
403
- }
404
381
}
405
382
) +
406
383
} ;
0 commit comments