Skip to content

Fix many collections implementing PartialEq #14734

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

Closed
wants to merge 2 commits into from
Closed

Conversation

tbu-
Copy link
Contributor

@tbu- tbu- commented Jun 7, 2014

They now properly check each element with the eq and ne methods in their
own eq and ne method, respectively.

They now properly check each element with the `eq` and `ne` methods in their
own `eq` and `ne` method, respectively.
@tbu-
Copy link
Contributor Author

tbu- commented Jun 7, 2014

See also #14733.

}
fn ne(&self, other: &RingBuf<A>) -> bool {
!self.eq(other)
self.nelts != other.nelts &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The && should be an ||

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it should be any instead of all.

@tbu-
Copy link
Contributor Author

tbu- commented Jun 8, 2014

With #14733 this will only be needed for consistency.

@alexcrichton
Copy link
Member

Would it be possible to add tests for this functionality? This seems very easy to get wrong during a refactoring.

@sfackler
Copy link
Member

sfackler commented Jun 8, 2014

I don't think this is necessary now that we guarantee that == and != are inverses.

@tbu-
Copy link
Contributor Author

tbu- commented Jun 8, 2014

@alexcrichton
Should I put the tests under src/tests/runpass/?

@sfackler
It's not strictly necessary – yet it would be nice to have some consistency among library defined types, e.g. always define both, or always only define eq.

@alexcrichton
Copy link
Member

Yes run-pass may be the best place to put them as they will likely share the same type to be checking that ne is invoked rather than eq

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with a rebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants