-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Variable labeling of complex match arms should be able to label the whole arm #15219
Comments
As work-around for types like primitives, you can write let x = ...;
match x {
0x2A | 0x2D | ... => println!("{}", x),
} i.e. doing the binding outside the |
Yeah, that's close to what I ended up doing. |
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#673 |
Unify getter and setter assists This PR combines what previously have been two different files into a single file. I want to talk about the reasons why I did this. The issue that prompted this PR ( and before I forget : this pr fixes rust-lang#15080 ) mentions an interesting behavior. We combine these two assists into an assist group and the order in which the assists are listed in this group changes depending on the text range of the selected area. The reason for that is that VSCode prioritizes actions that have a bigger impact in a smaller area and until now generate setter assist was only possible to be invoked for a single field whereas you could generate multiple getters for the getter assist. So I used the latter's infra to make former applicable to multiple fields, hence the unification. So this PR solves in essence 1. Make `generate setter` applicable to multiple fields 2. Provide a consistent order of the said assists in listing.
If I have a match arm like this:
the following does not work:
In the former example, the
a
is bound to the first literal only, and in the latter the compiler thinks that it is a tuple (and complains about the lack of commas).Of course, one can do
but that is cumbersome.
Could we get a way to easily bind a variable to the entire match arm?
The text was updated successfully, but these errors were encountered: