-
Notifications
You must be signed in to change notification settings - Fork 14
Fix wrong behavior of Eq & Ord #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.