mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 00:53:48 +00:00
auto merge of #8357 : omasanori/rust/cleanup, r=alexcrichton
I feel it's time to eliminate them (and add some testcases.)
This commit is contained in:
commit
094e4260f8
@ -57,9 +57,6 @@ impl Ord for Timespec {
|
||||
self.sec < other.sec ||
|
||||
(self.sec == other.sec && self.nsec < other.nsec)
|
||||
}
|
||||
fn le(&self, other: &Timespec) -> bool { !other.lt(self) }
|
||||
fn ge(&self, other: &Timespec) -> bool { !self.lt(other) }
|
||||
fn gt(&self, other: &Timespec) -> bool { !self.le(other) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,12 +284,6 @@ impl Not<bool> for bool {
|
||||
impl Ord for bool {
|
||||
#[inline]
|
||||
fn lt(&self, other: &bool) -> bool { to_bit(*self) < to_bit(*other) }
|
||||
#[inline]
|
||||
fn le(&self, other: &bool) -> bool { to_bit(*self) <= to_bit(*other) }
|
||||
#[inline]
|
||||
fn gt(&self, other: &bool) -> bool { to_bit(*self) > to_bit(*other) }
|
||||
#[inline]
|
||||
fn ge(&self, other: &bool) -> bool { to_bit(*self) >= to_bit(*other) }
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
|
@ -322,12 +322,6 @@ impl Eq for char {
|
||||
impl Ord for char {
|
||||
#[inline]
|
||||
fn lt(&self, other: &char) -> bool { *self < *other }
|
||||
#[inline]
|
||||
fn le(&self, other: &char) -> bool { *self <= *other }
|
||||
#[inline]
|
||||
fn gt(&self, other: &char) -> bool { *self > *other }
|
||||
#[inline]
|
||||
fn ge(&self, other: &char) -> bool { *self >= *other }
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
|
@ -101,12 +101,6 @@ impl TotalOrd for Ordering {
|
||||
impl Ord for Ordering {
|
||||
#[inline]
|
||||
fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) }
|
||||
#[inline]
|
||||
fn le(&self, other: &Ordering) -> bool { (*self as int) <= (*other as int) }
|
||||
#[inline]
|
||||
fn gt(&self, other: &Ordering) -> bool { (*self as int) > (*other as int) }
|
||||
#[inline]
|
||||
fn ge(&self, other: &Ordering) -> bool { (*self as int) >= (*other as int) }
|
||||
}
|
||||
|
||||
macro_rules! totalord_impl(
|
||||
@ -174,8 +168,11 @@ pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
|
||||
#[lang="ord"]
|
||||
pub trait Ord {
|
||||
fn lt(&self, other: &Self) -> bool;
|
||||
#[inline]
|
||||
fn le(&self, other: &Self) -> bool { !other.lt(self) }
|
||||
#[inline]
|
||||
fn gt(&self, other: &Self) -> bool { other.lt(self) }
|
||||
#[inline]
|
||||
fn ge(&self, other: &Self) -> bool { !self.lt(other) }
|
||||
}
|
||||
|
||||
|
@ -33,12 +33,6 @@ impl Eq for () {
|
||||
impl Ord for () {
|
||||
#[inline]
|
||||
fn lt(&self, _other: &()) -> bool { false }
|
||||
#[inline]
|
||||
fn le(&self, _other: &()) -> bool { true }
|
||||
#[inline]
|
||||
fn ge(&self, _other: &()) -> bool { true }
|
||||
#[inline]
|
||||
fn gt(&self, _other: &()) -> bool { false }
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
|
@ -130,12 +130,6 @@ impl Num for $T {}
|
||||
impl Ord for $T {
|
||||
#[inline]
|
||||
fn lt(&self, other: &$T) -> bool { return (*self) < (*other); }
|
||||
#[inline]
|
||||
fn le(&self, other: &$T) -> bool { return (*self) <= (*other); }
|
||||
#[inline]
|
||||
fn ge(&self, other: &$T) -> bool { return (*self) >= (*other); }
|
||||
#[inline]
|
||||
fn gt(&self, other: &$T) -> bool { return (*self) > (*other); }
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
|
@ -131,12 +131,6 @@ impl Num for $T {}
|
||||
impl Ord for $T {
|
||||
#[inline]
|
||||
fn lt(&self, other: &$T) -> bool { (*self) < (*other) }
|
||||
#[inline]
|
||||
fn le(&self, other: &$T) -> bool { (*self) <= (*other) }
|
||||
#[inline]
|
||||
fn ge(&self, other: &$T) -> bool { (*self) >= (*other) }
|
||||
#[inline]
|
||||
fn gt(&self, other: &$T) -> bool { (*self) > (*other) }
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
|
@ -1050,34 +1050,16 @@ pub mod traits {
|
||||
impl<'self> Ord for &'self str {
|
||||
#[inline]
|
||||
fn lt(&self, other: & &'self str) -> bool { self.cmp(other) == Less }
|
||||
#[inline]
|
||||
fn le(&self, other: & &'self str) -> bool { self.cmp(other) != Greater }
|
||||
#[inline]
|
||||
fn ge(&self, other: & &'self str) -> bool { self.cmp(other) != Less }
|
||||
#[inline]
|
||||
fn gt(&self, other: & &'self str) -> bool { self.cmp(other) == Greater }
|
||||
}
|
||||
|
||||
impl Ord for ~str {
|
||||
#[inline]
|
||||
fn lt(&self, other: &~str) -> bool { self.cmp(other) == Less }
|
||||
#[inline]
|
||||
fn le(&self, other: &~str) -> bool { self.cmp(other) != Greater }
|
||||
#[inline]
|
||||
fn ge(&self, other: &~str) -> bool { self.cmp(other) != Less }
|
||||
#[inline]
|
||||
fn gt(&self, other: &~str) -> bool { self.cmp(other) == Greater }
|
||||
}
|
||||
|
||||
impl Ord for @str {
|
||||
#[inline]
|
||||
fn lt(&self, other: &@str) -> bool { self.cmp(other) == Less }
|
||||
#[inline]
|
||||
fn le(&self, other: &@str) -> bool { self.cmp(other) != Greater }
|
||||
#[inline]
|
||||
fn ge(&self, other: &@str) -> bool { self.cmp(other) != Less }
|
||||
#[inline]
|
||||
fn gt(&self, other: &@str) -> bool { self.cmp(other) == Greater }
|
||||
}
|
||||
|
||||
impl<'self, S: Str> Equiv<S> for &'self str {
|
||||
|
Loading…
Reference in New Issue
Block a user