diff options
| -rw-r--r-- | src/libcollections/ring_buf.rs | 3 | ||||
| -rw-r--r-- | src/libcollections/vec_map.rs | 13 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index d4bd9b5228a..2715ff0678a 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -1295,9 +1295,6 @@ impl<A: PartialEq> PartialEq for RingBuf<A> { self.len() == other.len() && self.iter().zip(other.iter()).all(|(a, b)| a.eq(b)) } - fn ne(&self, other: &RingBuf<A>) -> bool { - !self.eq(other) - } } impl<A: Eq> Eq for RingBuf<A> {} diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 207e27ccdcc..659c68c42dd 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -60,7 +60,6 @@ use vec::Vec; /// months.clear(); /// assert!(months.is_empty()); /// ``` -#[deriving(PartialEq, Eq)] pub struct VecMap<V> { v: Vec<Option<V>>, } @@ -492,6 +491,14 @@ impl<V:Clone> VecMap<V> { } } +impl<V: PartialEq> PartialEq for VecMap<V> { + fn eq(&self, other: &VecMap<V>) -> bool { + iter::order::eq(self.iter(), other.iter()) + } +} + +impl<V: Eq> Eq for VecMap<V> {} + impl<V: PartialOrd> PartialOrd for VecMap<V> { #[inline] fn partial_cmp(&self, other: &VecMap<V>) -> Option<Ordering> { @@ -955,6 +962,10 @@ mod test_map { assert!(a != b); assert!(b.insert(5, 19).is_none()); assert!(a == b); + + a = VecMap::new(); + b = VecMap::with_capacity(1); + assert!(a == b); } #[test] |
