mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 23:22:58 +00:00
Audit core::cmp
for int/uint
.
* cast 3-valued `core::cmp::Ordering` to `i32`, not `int`. * use `isize`/`usize` in the impl macros.
This commit is contained in:
parent
f82e2310b3
commit
343909bca1
@ -215,7 +215,7 @@ impl Ord for Ordering {
|
|||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn cmp(&self, other: &Ordering) -> Ordering {
|
fn cmp(&self, other: &Ordering) -> Ordering {
|
||||||
(*self as int).cmp(&(*other as int))
|
(*self as i32).cmp(&(*other as i32))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ impl PartialOrd for Ordering {
|
|||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> {
|
||||||
(*self as int).partial_cmp(&(*other as int))
|
(*self as i32).partial_cmp(&(*other as i32))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
partial_eq_impl! {
|
partial_eq_impl! {
|
||||||
bool char uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64
|
bool char usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! eq_impl {
|
macro_rules! eq_impl {
|
||||||
@ -492,7 +492,7 @@ mod impls {
|
|||||||
)*)
|
)*)
|
||||||
}
|
}
|
||||||
|
|
||||||
eq_impl! { () bool char uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
eq_impl! { () bool char usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
|
||||||
|
|
||||||
macro_rules! partial_ord_impl {
|
macro_rules! partial_ord_impl {
|
||||||
($($t:ty)*) => ($(
|
($($t:ty)*) => ($(
|
||||||
@ -535,7 +535,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
partial_ord_impl! { char uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
partial_ord_impl! { char usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
|
||||||
|
|
||||||
macro_rules! ord_impl {
|
macro_rules! ord_impl {
|
||||||
($($t:ty)*) => ($(
|
($($t:ty)*) => ($(
|
||||||
@ -565,7 +565,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ord_impl! { char uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
ord_impl! { char usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
|
||||||
|
|
||||||
// & pointers
|
// & pointers
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user