Skip to content

Commit 094e426

Browse files
committed
auto merge of #8357 : omasanori/rust/cleanup, r=alexcrichton
I feel it's time to eliminate them (and add some testcases.)
2 parents a931e04 + b4d6ae5 commit 094e426

File tree

8 files changed

+3
-57
lines changed

8 files changed

+3
-57
lines changed

src/libextra/time.rs

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ impl Ord for Timespec {
5757
self.sec < other.sec ||
5858
(self.sec == other.sec && self.nsec < other.nsec)
5959
}
60-
fn le(&self, other: &Timespec) -> bool { !other.lt(self) }
61-
fn ge(&self, other: &Timespec) -> bool { !self.lt(other) }
62-
fn gt(&self, other: &Timespec) -> bool { !self.le(other) }
6360
}
6461

6562
/**

src/libstd/bool.rs

-6
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,6 @@ impl Not<bool> for bool {
284284
impl Ord for bool {
285285
#[inline]
286286
fn lt(&self, other: &bool) -> bool { to_bit(*self) < to_bit(*other) }
287-
#[inline]
288-
fn le(&self, other: &bool) -> bool { to_bit(*self) <= to_bit(*other) }
289-
#[inline]
290-
fn gt(&self, other: &bool) -> bool { to_bit(*self) > to_bit(*other) }
291-
#[inline]
292-
fn ge(&self, other: &bool) -> bool { to_bit(*self) >= to_bit(*other) }
293287
}
294288

295289
#[cfg(not(test))]

src/libstd/char.rs

-6
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,6 @@ impl Eq for char {
322322
impl Ord for char {
323323
#[inline]
324324
fn lt(&self, other: &char) -> bool { *self < *other }
325-
#[inline]
326-
fn le(&self, other: &char) -> bool { *self <= *other }
327-
#[inline]
328-
fn gt(&self, other: &char) -> bool { *self > *other }
329-
#[inline]
330-
fn ge(&self, other: &char) -> bool { *self >= *other }
331325
}
332326

333327
#[cfg(not(test))]

src/libstd/cmp.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ impl TotalOrd for Ordering {
101101
impl Ord for Ordering {
102102
#[inline]
103103
fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) }
104-
#[inline]
105-
fn le(&self, other: &Ordering) -> bool { (*self as int) <= (*other as int) }
106-
#[inline]
107-
fn gt(&self, other: &Ordering) -> bool { (*self as int) > (*other as int) }
108-
#[inline]
109-
fn ge(&self, other: &Ordering) -> bool { (*self as int) >= (*other as int) }
110104
}
111105

112106
macro_rules! totalord_impl(
@@ -174,8 +168,11 @@ pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
174168
#[lang="ord"]
175169
pub trait Ord {
176170
fn lt(&self, other: &Self) -> bool;
171+
#[inline]
177172
fn le(&self, other: &Self) -> bool { !other.lt(self) }
173+
#[inline]
178174
fn gt(&self, other: &Self) -> bool { other.lt(self) }
175+
#[inline]
179176
fn ge(&self, other: &Self) -> bool { !self.lt(other) }
180177
}
181178

src/libstd/nil.rs

-6
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ impl Eq for () {
3333
impl Ord for () {
3434
#[inline]
3535
fn lt(&self, _other: &()) -> bool { false }
36-
#[inline]
37-
fn le(&self, _other: &()) -> bool { true }
38-
#[inline]
39-
fn ge(&self, _other: &()) -> bool { true }
40-
#[inline]
41-
fn gt(&self, _other: &()) -> bool { false }
4236
}
4337

4438
#[cfg(not(test))]

src/libstd/num/int_macros.rs

-6
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,6 @@ impl Num for $T {}
130130
impl Ord for $T {
131131
#[inline]
132132
fn lt(&self, other: &$T) -> bool { return (*self) < (*other); }
133-
#[inline]
134-
fn le(&self, other: &$T) -> bool { return (*self) <= (*other); }
135-
#[inline]
136-
fn ge(&self, other: &$T) -> bool { return (*self) >= (*other); }
137-
#[inline]
138-
fn gt(&self, other: &$T) -> bool { return (*self) > (*other); }
139133
}
140134
141135
#[cfg(not(test))]

src/libstd/num/uint_macros.rs

-6
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ impl Num for $T {}
131131
impl Ord for $T {
132132
#[inline]
133133
fn lt(&self, other: &$T) -> bool { (*self) < (*other) }
134-
#[inline]
135-
fn le(&self, other: &$T) -> bool { (*self) <= (*other) }
136-
#[inline]
137-
fn ge(&self, other: &$T) -> bool { (*self) >= (*other) }
138-
#[inline]
139-
fn gt(&self, other: &$T) -> bool { (*self) > (*other) }
140134
}
141135

142136
#[cfg(not(test))]

src/libstd/str.rs

-18
Original file line numberDiff line numberDiff line change
@@ -1050,34 +1050,16 @@ pub mod traits {
10501050
impl<'self> Ord for &'self str {
10511051
#[inline]
10521052
fn lt(&self, other: & &'self str) -> bool { self.cmp(other) == Less }
1053-
#[inline]
1054-
fn le(&self, other: & &'self str) -> bool { self.cmp(other) != Greater }
1055-
#[inline]
1056-
fn ge(&self, other: & &'self str) -> bool { self.cmp(other) != Less }
1057-
#[inline]
1058-
fn gt(&self, other: & &'self str) -> bool { self.cmp(other) == Greater }
10591053
}
10601054
10611055
impl Ord for ~str {
10621056
#[inline]
10631057
fn lt(&self, other: &~str) -> bool { self.cmp(other) == Less }
1064-
#[inline]
1065-
fn le(&self, other: &~str) -> bool { self.cmp(other) != Greater }
1066-
#[inline]
1067-
fn ge(&self, other: &~str) -> bool { self.cmp(other) != Less }
1068-
#[inline]
1069-
fn gt(&self, other: &~str) -> bool { self.cmp(other) == Greater }
10701058
}
10711059
10721060
impl Ord for @str {
10731061
#[inline]
10741062
fn lt(&self, other: &@str) -> bool { self.cmp(other) == Less }
1075-
#[inline]
1076-
fn le(&self, other: &@str) -> bool { self.cmp(other) != Greater }
1077-
#[inline]
1078-
fn ge(&self, other: &@str) -> bool { self.cmp(other) != Less }
1079-
#[inline]
1080-
fn gt(&self, other: &@str) -> bool { self.cmp(other) == Greater }
10811063
}
10821064
10831065
impl<'self, S: Str> Equiv<S> for &'self str {

0 commit comments

Comments
 (0)