Skip to content

Simplify match patterns to be more ergonomic #115

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

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

yotamofek
Copy link
Contributor

@yotamofek yotamofek commented Feb 17, 2025

Some of the code in this crate is around a decade old, which means it couldn't use the ergonomic benefits afforded by RFC 2005 (which was stabilized around 2017 or 2018).

So now instead of doing match *thing { ref mut thing => { ... } }, we can just do match thing { thing => { ... } }.

See discussion here: #113 (comment)

@cuviper
Copy link
Member

cuviper commented Feb 17, 2025

I admit I still have some lingering preference to be explicit, but I'm learning to live with it. e.g. as_ref and as_mut look like weird no-ops now, but with match ergonomics it really is translating the references. Oh well, not a big deal in the end.

Thanks!

@cuviper cuviper added this pull request to the merge queue Feb 17, 2025
Merged via the queue into rayon-rs:main with commit b0d533a Feb 17, 2025
10 checks passed
@yotamofek yotamofek deleted the simplify-patterns branch February 17, 2025 19:45
@yotamofek
Copy link
Contributor Author

I started learning rust after match ergonomics were stabilized and I feel the opposite - ref and ref mut always look really weird to me. Guess it's really a matter of what you're used to. :)

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.

2 participants