about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorOGINO Masanori <masanori.ogino@gmail.com>2013-08-08 10:03:34 +0900
committerOGINO Masanori <masanori.ogino@gmail.com>2013-08-09 14:28:14 +0900
commitb4d6ae5bb8959affdb91a6b6791e725f97787344 (patch)
treedc260f75791e1d195a457ca5acb5d9a1df9a7ea5 /src/libstd/num
parent7a1b61d6317c27b735e5471d3d704584bea4c925 (diff)
downloadrust-b4d6ae5bb8959affdb91a6b6791e725f97787344.tar.gz
rust-b4d6ae5bb8959affdb91a6b6791e725f97787344.zip
Remove redundant Ord method impls.
Basically, generic containers should not use the default methods since a
type of elements may not guarantees total order. str could use them
since u8's Ord guarantees total order. Floating point numbers are also
broken with the default methods because of NaN. Thanks for @thestinger.

Timespec also guarantees total order AIUI. I'm unsure whether
extra::semver::Identifier does so I left it alone. Proof needed.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/int_macros.rs6
-rw-r--r--src/libstd/num/uint_macros.rs6
2 files changed, 0 insertions, 12 deletions
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index b692bedebfd..41da9a6ccbe 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -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))]
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 29b8f29d87d..86b5b4ddfc0 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -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))]