Skip to content

Commit

Permalink
collections: Implement Eq for DList, RingBuf, TreeMap, TreeSet
Browse files Browse the repository at this point in the history
  • Loading branch information
nham committed Aug 1, 2014
1 parent f2fa559 commit 25acfde
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ impl<A: PartialEq> PartialEq for DList<A> {
}
}

impl<A: Eq> Eq for DList<A> {}

impl<A: PartialOrd> PartialOrd for DList<A> {
fn partial_cmp(&self, other: &DList<A>) -> Option<Ordering> {
iter::order::partial_cmp(self.iter(), other.iter())
Expand Down
2 changes: 2 additions & 0 deletions src/libcollections/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ impl<A: PartialEq> PartialEq for RingBuf<A> {
}
}

impl<A: Eq> Eq for RingBuf<A> {}

impl<A: PartialOrd> PartialOrd for RingBuf<A> {
fn partial_cmp(&self, other: &RingBuf<A>) -> Option<Ordering> {
iter::order::partial_cmp(self.iter(), other.iter())
Expand Down
4 changes: 4 additions & 0 deletions src/libcollections/treemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ impl<K: PartialEq + Ord, V: PartialEq> PartialEq for TreeMap<K, V> {
}
}

impl<K: Eq + Ord, V: Eq> Eq for TreeMap<K, V> {}

impl<K: Ord, V: PartialOrd> PartialOrd for TreeMap<K, V> {
#[inline]
fn partial_cmp(&self, other: &TreeMap<K, V>) -> Option<Ordering> {
Expand Down Expand Up @@ -1010,6 +1012,8 @@ impl<T: PartialEq + Ord> PartialEq for TreeSet<T> {
fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
}

impl<T: Eq + Ord> Eq for TreeSet<T> {}

impl<T: Ord> PartialOrd for TreeSet<T> {
#[inline]
fn partial_cmp(&self, other: &TreeSet<T>) -> Option<Ordering> {
Expand Down

0 comments on commit 25acfde

Please sign in to comment.