about summary refs log tree commit diff
path: root/src/libnum/rational.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-03-23 22:54:42 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2014-03-23 23:48:10 +1100
commitf6db0ef9464a17fa6e547e755b1b5dfa09af9499 (patch)
tree671ec7c6a30cc425d47f83ca1b4efd2f1c71dbca /src/libnum/rational.rs
parent2ddb60565423bdc225ccc8dd4ebfb653c5650ba2 (diff)
std: remove the `equals` method from `TotalEq`.
`TotalEq` is now just an assertion about the `Eq` impl of a
type (i.e. `==` is a total equality if a type implements `TotalEq`) so
the extra method is just confusing.

Also, a new method magically appeared as a hack to allow deriving to
assert that the contents of a struct/enum are also TotalEq, because the
deriving infrastructure makes it very hard to do anything but create a
trait method. (You didn't hear about this horrible work-around from me
:(.)
Diffstat (limited to 'src/libnum/rational.rs')
-rw-r--r--src/libnum/rational.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs
index a71674c4122..6fb3d492432 100644
--- a/src/libnum/rational.rs
+++ b/src/libnum/rational.rs
@@ -147,20 +147,20 @@ macro_rules! cmp_impl {
         cmp_impl!(impl $imp, $($method -> bool),+)
     };
     // return something other than a Ratio<T>
-    (impl $imp:ident, $($method:ident -> $res:ty),+) => {
+    (impl $imp:ident, $($method:ident -> $res:ty),*) => {
         impl<T: Mul<T,T> + $imp> $imp for Ratio<T> {
             $(
                 #[inline]
                 fn $method(&self, other: &Ratio<T>) -> $res {
                     (self.numer * other.denom). $method (&(self.denom*other.numer))
                 }
-            )+
+            )*
         }
     };
 }
 cmp_impl!(impl Eq, eq, ne)
-cmp_impl!(impl TotalEq, equals)
 cmp_impl!(impl Ord, lt, gt, le, ge)
+cmp_impl!(impl TotalEq, )
 cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering)
 
 /* Arithmetic */