extra::dlist: Fix bug in Eq::ne

This commit is contained in:
blake2-ppc 2013-08-29 17:11:11 +02:00
parent 479aefb670
commit 15bb9b4e1a

View File

@ -594,7 +594,7 @@ impl<A: Eq> Eq for DList<A> {
} }
fn ne(&self, other: &DList<A>) -> bool { fn ne(&self, other: &DList<A>) -> bool {
self.len() != other.len() && self.len() != other.len() ||
iterator::order::ne(self.iter(), other.iter()) iterator::order::ne(self.iter(), other.iter())
} }
} }
@ -978,6 +978,10 @@ mod tests {
assert!(n != m); assert!(n != m);
m.push_back(1); m.push_back(1);
assert_eq!(&n, &m); assert_eq!(&n, &m);
let n = list_from([2,3,4]);
let m = list_from([1,2,3]);
assert!(n != m);
} }
#[test] #[test]