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

Add ability to use or-patterns within expressions in match arms #14516

Closed
Manishearth opened this issue May 29, 2014 · 2 comments
Closed

Add ability to use or-patterns within expressions in match arms #14516

Manishearth opened this issue May 29, 2014 · 2 comments

Comments

@Manishearth
Copy link
Member

We already can use patterns like Some(_) in a match arm. However, stuff like Some( 1 | 2 | 3) doesn't work.

Could support for nesting patterns be added?

@ben0x539
Copy link
Contributor

See also #9663—I guess this should go through the RFC process at this point

@alexcrichton
Copy link
Member

This is a dupe of #17180, and as @P1start mentioned over there the corresponding RFC is rust-lang/rfcs#99, so I'm going to close this in favor of the RFC.

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
Restrict "sort items" assist for traits & impls

This restricts the "sort items alphabetically" assist when the selection is inside a `Impl` or `Trait` node & intersects with one of the associated items.

It re-orders the conditional checks of AST nodes in the `sort_items` function to check for more specific nodes first before checking `Trait` or `Impl` nodes. The `AssistContext` is passed into the `add_sort_methods_assist` function to check if the selection intersects with any inner items, e.g. associated const or type alias, function. In this case the assist does not apply.

Fixes: rust-lang#14516
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

No branches or pull requests

3 participants