Fix wrong behavior of Eq & Ord#36
Conversation
As described in teloxide#35
The previous handwritten implementations were not consistent with each other as they allowed values a & b where a == b but a < b. Fixes teloxide#35
hirrolot
left a comment
There was a problem hiding this comment.
Thanks, LGTM. Would you also add a CHANGELOG.md entry explaining your changes? Thanks!
The current implementation only zips the two key iterators together. So if one of them is a subset of the other it only checks the keys in the subset for equality. In the simplest case, the empty dependency map is equal to every other dependency map.
Analogous to how equality is defined for BTreeMap, but only looking at keys.
hirrolot
left a comment
There was a problem hiding this comment.
Thanks again for figuring this out!
|
Okay, I just added an entry to the Changelog. Also I was looking at other PartialEq implementations in the project and noticed that the one for |
|
I've released v0.5.1 with your fix. |
I realized that the easiest way is to just rely on the derived implementations of the Eq and Ord traits.
To still get alphabetical sorting we must put the name field before the id field.
Added two tests that fail on master and pass now.