-
Notifications
You must be signed in to change notification settings - Fork 175
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
Implement Eq
and Hash
for PopupSurface
#1200
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1200 +/- ##
=======================================
Coverage 21.98% 21.99%
=======================================
Files 154 154
Lines 24093 24097 +4
=======================================
+ Hits 5298 5301 +3
- Misses 18795 18796 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
|
||
impl std::hash::Hash for PopupSurface { | ||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) { | ||
// self.alive().hash(state); |
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.
// self.alive().hash(state); |
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.
This matches above where it is commented out in the PartialEq
implementation. Since Hash
has to be kept in sync with the PartialEq
implementation, either the commented out part should be entirely removed, or this should remain in case it is un-commented-out.
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.
having dead commented out code looks like an artifact, so it must be removed.
So the commented out Wayland objects (which includes the Which violates the invariant of |
Commenting out code is not a good way to document anything. You can always write something and explain why something doesn't work. You can also add doc comments to trait impl methods explaining that. Like commented out code should never be the case in nearly any language, it's like the worst. |
I don't disagree, but I also don't remember how the code ended up this way. It certainly wasn't meant to be documentation, I guess this happened during the large wayland 0.30 PRs and this was simply overlooked. I just mentioned it, because it prompted me to lookup the wayland-client PartialEq implementation. |
@Antikyth first of all thank you for the contribution. Can you maybe explain your use-case for this a bit more? I am trying to think of a good alternative to suggest, given that this code won't work as is, and I think would help knowing what kind of data you are storing. |
Does what it says on the tin. This allows
PopupSurface
to be used inHashMap
s, should compositors wish to associate custom state with a popup.Closes #1199.