Skip to content

Commit 6e3dc00

Browse files
committed
flesh out comparison trait impls
1 parent 7f02500 commit 6e3dc00

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/lib.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,11 @@ impl<A: fmt::Debug + Hash + Eq, B: fmt::Debug, S: HashState> fmt::Debug for Link
603603

604604
impl<K: Hash + Eq, V: PartialEq, S: HashState> PartialEq for LinkedHashMap<K, V, S> {
605605
fn eq(&self, other: &LinkedHashMap<K, V, S>) -> bool {
606-
self.len() == other.len() && self.iter().zip(other.iter()).all(|(l, r)| l == r)
606+
self.len() == other.len() && iter::order::eq(self.iter(), other.iter())
607+
}
608+
609+
fn ne(&self, other: &LinkedHashMap<K, V, S>) -> bool {
610+
self.len() != other.len() || iter::order::ne(self.iter(), other.iter())
607611
}
608612
}
609613

@@ -613,6 +617,22 @@ impl<K: Hash + Eq + PartialOrd, V: PartialOrd, S: HashState> PartialOrd for Link
613617
fn partial_cmp(&self, other: &LinkedHashMap<K, V, S>) -> Option<Ordering> {
614618
iter::order::partial_cmp(self.iter(), other.iter())
615619
}
620+
621+
fn lt(&self, other: &LinkedHashMap<K, V, S>) -> bool {
622+
iter::order::lt(self.iter(), other.iter())
623+
}
624+
625+
fn le(&self, other: &LinkedHashMap<K, V, S>) -> bool {
626+
iter::order::le(self.iter(), other.iter())
627+
}
628+
629+
fn ge(&self, other: &LinkedHashMap<K, V, S>) -> bool {
630+
iter::order::ge(self.iter(), other.iter())
631+
}
632+
633+
fn gt(&self, other: &LinkedHashMap<K, V, S>) -> bool {
634+
iter::order::gt(self.iter(), other.iter())
635+
}
616636
}
617637

618638
impl<K: Hash + Eq + Ord, V: Ord, S: HashState> Ord for LinkedHashMap<K, V, S> {

0 commit comments

Comments
 (0)