Skip to content

Commit 343909b

Browse files
committed
Audit core::cmp for int/uint.
* cast 3-valued `core::cmp::Ordering` to `i32`, not `int`. * use `isize`/`usize` in the impl macros.
1 parent f82e231 commit 343909b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libcore/cmp.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl Ord for Ordering {
215215
#[inline]
216216
#[stable(feature = "rust1", since = "1.0.0")]
217217
fn cmp(&self, other: &Ordering) -> Ordering {
218-
(*self as int).cmp(&(*other as int))
218+
(*self as i32).cmp(&(*other as i32))
219219
}
220220
}
221221

@@ -224,7 +224,7 @@ impl PartialOrd for Ordering {
224224
#[inline]
225225
#[stable(feature = "rust1", since = "1.0.0")]
226226
fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> {
227-
(*self as int).partial_cmp(&(*other as int))
227+
(*self as i32).partial_cmp(&(*other as i32))
228228
}
229229
}
230230

@@ -482,7 +482,7 @@ mod impls {
482482
}
483483

484484
partial_eq_impl! {
485-
bool char uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64
485+
bool char usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64
486486
}
487487

488488
macro_rules! eq_impl {
@@ -492,7 +492,7 @@ mod impls {
492492
)*)
493493
}
494494

495-
eq_impl! { () bool char uint u8 u16 u32 u64 int i8 i16 i32 i64 }
495+
eq_impl! { () bool char usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
496496

497497
macro_rules! partial_ord_impl {
498498
($($t:ty)*) => ($(
@@ -535,7 +535,7 @@ mod impls {
535535
}
536536
}
537537

538-
partial_ord_impl! { char uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
538+
partial_ord_impl! { char usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
539539

540540
macro_rules! ord_impl {
541541
($($t:ty)*) => ($(
@@ -565,7 +565,7 @@ mod impls {
565565
}
566566
}
567567

568-
ord_impl! { char uint u8 u16 u32 u64 int i8 i16 i32 i64 }
568+
ord_impl! { char usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
569569

570570
// & pointers
571571

0 commit comments

Comments
 (0)