From f6db0ef9464a17fa6e547e755b1b5dfa09af9499 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Sun, 23 Mar 2014 22:54:42 +1100 Subject: 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 :(.) --- src/libstd/slice.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/libstd/slice.rs') diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index 12718c55923..bb5b36896af 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -649,17 +649,9 @@ pub mod traits { fn ne(&self, other: &~[T]) -> bool { !self.eq(other) } } - impl<'a,T:TotalEq> TotalEq for &'a [T] { - fn equals(&self, other: & &'a [T]) -> bool { - self.len() == other.len() && - order::equals(self.iter(), other.iter()) - } - } + impl<'a,T:TotalEq> TotalEq for &'a [T] {} - impl TotalEq for ~[T] { - #[inline] - fn equals(&self, other: &~[T]) -> bool { self.as_slice().equals(&other.as_slice()) } - } + impl TotalEq for ~[T] {} impl<'a,T:Eq, V: Vector> Equiv for &'a [T] { #[inline] -- cgit 1.4.1-3-g733a5