@@ -22,9 +22,6 @@ use super::{FusedIterator, TrustedLen};
22
22
reason = "likely to be replaced by finer-grained traits" ,
23
23
issue = "42168" ) ]
24
24
pub trait Step : PartialOrd + Sized {
25
- /// Steps `self` if possible.
26
- fn step ( & self , by : & Self ) -> Option < Self > ;
27
-
28
25
/// Returns the number of steps between two step objects. The count is
29
26
/// inclusive of `start` and exclusive of `end`.
30
27
///
@@ -35,9 +32,6 @@ pub trait Step: PartialOrd + Sized {
35
32
/// Same as `steps_between`, but with a `by` of 1
36
33
fn steps_between_by_one ( start : & Self , end : & Self ) -> Option < usize > ;
37
34
38
- /// Tests whether this step is negative or not (going backwards)
39
- fn is_negative ( & self ) -> bool ;
40
-
41
35
/// Replaces this step with `1`, returning itself
42
36
fn replace_one ( & mut self ) -> Self ;
43
37
@@ -57,10 +51,6 @@ macro_rules! step_impl_unsigned {
57
51
reason = "likely to be replaced by finer-grained traits" ,
58
52
issue = "42168" ) ]
59
53
impl Step for $t {
60
- #[ inline]
61
- fn step( & self , by: & $t) -> Option <$t> {
62
- ( * self ) . checked_add( * by)
63
- }
64
54
#[ inline]
65
55
#[ allow( trivial_numeric_casts) ]
66
56
fn steps_between( start: & $t, end: & $t, by: & $t) -> Option <usize > {
@@ -79,11 +69,6 @@ macro_rules! step_impl_unsigned {
79
69
}
80
70
}
81
71
82
- #[ inline]
83
- fn is_negative( & self ) -> bool {
84
- false
85
- }
86
-
87
72
#[ inline]
88
73
fn replace_one( & mut self ) -> Self {
89
74
mem:: replace( self , 1 )
@@ -117,10 +102,6 @@ macro_rules! step_impl_signed {
117
102
reason = "likely to be replaced by finer-grained traits" ,
118
103
issue = "42168" ) ]
119
104
impl Step for $t {
120
- #[ inline]
121
- fn step( & self , by: & $t) -> Option <$t> {
122
- ( * self ) . checked_add( * by)
123
- }
124
105
#[ inline]
125
106
#[ allow( trivial_numeric_casts) ]
126
107
fn steps_between( start: & $t, end: & $t, by: & $t) -> Option <usize > {
@@ -150,11 +131,6 @@ macro_rules! step_impl_signed {
150
131
}
151
132
}
152
133
153
- #[ inline]
154
- fn is_negative( & self ) -> bool {
155
- * self < 0
156
- }
157
-
158
134
#[ inline]
159
135
fn replace_one( & mut self ) -> Self {
160
136
mem:: replace( self , 1 )
@@ -189,21 +165,11 @@ macro_rules! step_impl_no_between {
189
165
reason = "likely to be replaced by finer-grained traits" ,
190
166
issue = "42168" ) ]
191
167
impl Step for $t {
192
- #[ inline]
193
- fn step( & self , by: & $t) -> Option <$t> {
194
- ( * self ) . checked_add( * by)
195
- }
196
168
#[ inline]
197
169
fn steps_between( _a: & $t, _b: & $t, _by: & $t) -> Option <usize > {
198
170
None
199
171
}
200
172
201
- #[ inline]
202
- #[ allow( unused_comparisons) ]
203
- fn is_negative( & self ) -> bool {
204
- * self < 0
205
- }
206
-
207
173
#[ inline]
208
174
fn replace_one( & mut self ) -> Self {
209
175
mem:: replace( self , 1 )
0 commit comments