Skip to content

Commit dc607de

Browse files
use UFCS with Add::add and Sub::sub instead of unstable attributes
1 parent 19fd7fc commit dc607de

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/libcore/iter/range.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,13 @@ macro_rules! step_impl_unsigned {
9595
}
9696

9797
#[inline]
98-
#[rustc_inherit_overflow_checks]
9998
fn add_one(&self) -> Self {
100-
*self + 1
99+
Add::add(*self, 1);
101100
}
102101

103102
#[inline]
104-
#[rustc_inherit_overflow_checks]
105103
fn sub_one(&self) -> Self {
106-
*self - 1
104+
Sub::sub(*self, 1);
107105
}
108106

109107
#[inline]
@@ -168,15 +166,13 @@ macro_rules! step_impl_signed {
168166
}
169167

170168
#[inline]
171-
#[rustc_inherit_overflow_checks]
172169
fn add_one(&self) -> Self {
173-
*self + 1
170+
Add::add(*self, 1);
174171
}
175172

176173
#[inline]
177-
#[rustc_inherit_overflow_checks]
178174
fn sub_one(&self) -> Self {
179-
*self - 1
175+
Sub::sub(*self, 1);
180176
}
181177

182178
#[inline]
@@ -219,15 +215,13 @@ macro_rules! step_impl_no_between {
219215
}
220216

221217
#[inline]
222-
#[rustc_inherit_overflow_checks]
223218
fn add_one(&self) -> Self {
224-
*self + 1
219+
Add::add(*self, 1);
225220
}
226221

227222
#[inline]
228-
#[rustc_inherit_overflow_checks]
229223
fn sub_one(&self) -> Self {
230-
*self - 1
224+
Sub::sub(*self, 1);
231225
}
232226

233227
#[inline]

0 commit comments

Comments
 (0)