]> git.lizzy.rs Git - rust.git/commitdiff
add a TotalOrd impl for the unit type
authorDaniel Micay <danielmicay@gmail.com>
Sat, 9 Mar 2013 01:05:20 +0000 (20:05 -0500)
committerDaniel Micay <danielmicay@gmail.com>
Sun, 10 Mar 2013 17:54:51 +0000 (13:54 -0400)
src/libcore/nil.rs

index cf2af7e38cc6ba36aee2a0245a2615acba3cd8ad..742e5a047d6ca7ab37128b66c3ed71d384a10bf1 100644 (file)
@@ -15,7 +15,7 @@
 */
 
 #[cfg(notest)]
-use cmp::{Eq, Ord};
+use cmp::{Eq, Ord, TotalOrd, Ordering, Equal};
 
 #[cfg(notest)]
 impl Eq for () {
@@ -37,3 +37,8 @@ impl Ord for () {
     pure fn gt(&self, _other: &()) -> bool { false }
 }
 
+#[cfg(notest)]
+impl TotalOrd for () {
+    #[inline(always)]
+    pure fn cmp(&self, _other: &()) -> Ordering { Equal }
+}