Skip to content
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

Remove comparable constraint from DedupBy #33

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

dwurf
Copy link
Contributor

@dwurf dwurf commented Apr 23, 2024

I couldn't see any reason for DedupBy to require elements in the slice to be comparable, since the comparison is done by the function.

This change relaxes the comparable constraint and adds a test case to prove that non-comparable types can be deduped.

The test case is a bit silly, but it's easy to imagine wanting to dedup structs with slices in them and needing this (which is
what I needed).

I couldn't see any reason for DedupBy to require elements in the slice to be comparable,
since the comparison is done by the function.

This change relaxes the `comparable` constraint and adds a test case to prove that
non-comparable types can be deduped.
@orsinium orsinium merged commit b5993eb into life4:master Apr 23, 2024
7 checks passed
@orsinium
Copy link
Member

Thank you! You're right, it looks like a copy-paste of Dedup :)

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

Successfully merging this pull request may close these issues.

2 participants