Skip to content

Commit 25acfde

Browse files
committed
collections: Implement Eq for DList, RingBuf, TreeMap, TreeSet
1 parent f2fa559 commit 25acfde

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/libcollections/dlist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,8 @@ impl<A: PartialEq> PartialEq for DList<A> {
683683
}
684684
}
685685

686+
impl<A: Eq> Eq for DList<A> {}
687+
686688
impl<A: PartialOrd> PartialOrd for DList<A> {
687689
fn partial_cmp(&self, other: &DList<A>) -> Option<Ordering> {
688690
iter::order::partial_cmp(self.iter(), other.iter())

src/libcollections/ringbuf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ impl<A: PartialEq> PartialEq for RingBuf<A> {
452452
}
453453
}
454454

455+
impl<A: Eq> Eq for RingBuf<A> {}
456+
455457
impl<A: PartialOrd> PartialOrd for RingBuf<A> {
456458
fn partial_cmp(&self, other: &RingBuf<A>) -> Option<Ordering> {
457459
iter::order::partial_cmp(self.iter(), other.iter())

src/libcollections/treemap.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ impl<K: PartialEq + Ord, V: PartialEq> PartialEq for TreeMap<K, V> {
173173
}
174174
}
175175

176+
impl<K: Eq + Ord, V: Eq> Eq for TreeMap<K, V> {}
177+
176178
impl<K: Ord, V: PartialOrd> PartialOrd for TreeMap<K, V> {
177179
#[inline]
178180
fn partial_cmp(&self, other: &TreeMap<K, V>) -> Option<Ordering> {
@@ -1010,6 +1012,8 @@ impl<T: PartialEq + Ord> PartialEq for TreeSet<T> {
10101012
fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
10111013
}
10121014

1015+
impl<T: Eq + Ord> Eq for TreeSet<T> {}
1016+
10131017
impl<T: Ord> PartialOrd for TreeSet<T> {
10141018
#[inline]
10151019
fn partial_cmp(&self, other: &TreeSet<T>) -> Option<Ordering> {

0 commit comments

Comments
 (0)