diff options
| author | Steven Fackler <sfackler@gmail.com> | 2014-06-17 23:25:51 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2014-06-29 21:42:09 -0700 |
| commit | 55cae0a094bbdcd0e9d5e697ce4f38cbd783bbc7 (patch) | |
| tree | 3385d84daae977e0d2bf08decdaf807e1d03337d /src/libcollections/dlist.rs | |
| parent | bb5695b95c288c442dbe528f7e1c1b08f79f033d (diff) | |
| download | rust-55cae0a094bbdcd0e9d5e697ce4f38cbd783bbc7.tar.gz rust-55cae0a094bbdcd0e9d5e697ce4f38cbd783bbc7.zip | |
Implement RFC#28: Add PartialOrd::partial_cmp
I ended up altering the semantics of Json's PartialOrd implementation. It used to be the case that Null < Null, but I can't think of any reason for an ordering other than the default one so I just switched it over to using the derived implementation. This also fixes broken `PartialOrd` implementations for `Vec` and `TreeMap`. RFC: 0028-partial-cmp
Diffstat (limited to 'src/libcollections/dlist.rs')
| -rw-r--r-- | src/libcollections/dlist.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 7ea5c482e61..4114c8cb1c4 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -595,17 +595,8 @@ impl<A: PartialEq> PartialEq for DList<A> { } impl<A: PartialOrd> PartialOrd for DList<A> { - fn lt(&self, other: &DList<A>) -> bool { - iter::order::lt(self.iter(), other.iter()) - } - fn le(&self, other: &DList<A>) -> bool { - iter::order::le(self.iter(), other.iter()) - } - fn gt(&self, other: &DList<A>) -> bool { - iter::order::gt(self.iter(), other.iter()) - } - fn ge(&self, other: &DList<A>) -> bool { - iter::order::ge(self.iter(), other.iter()) + fn partial_cmp(&self, other: &DList<A>) -> Option<Ordering> { + iter::order::partial_cmp(self.iter(), other.iter()) } } |
