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

Use slice patterns in rustc #61542

Closed
oli-obk opened this issue Jun 5, 2019 · 4 comments
Closed

Use slice patterns in rustc #61542

oli-obk opened this issue Jun 5, 2019 · 4 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Jun 5, 2019

After #61541 is merged, we should have a look at

let code = match (token_tree.len(), token_tree.get(0)) {
and replace all such workaround matches like that with matches that use slice patterns.

More examples in https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/mod.rs

@oli-obk oli-obk added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Jun 5, 2019
@Electron-libre
Copy link
Contributor

I can give it a try.
I think that searching through code for such workaround will take most of the time.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 7, 2019

Search for get(0), get(1) and such. Outside of tests these often can be a sign of workarounds.

@oli-obk oli-obk removed the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Jun 7, 2019
@Electron-libre
Copy link
Contributor

Ok, I am on it.

Centril added a commit to Centril/rust that referenced this issue Jun 12, 2019
…n_rustc, r=oli-obk,Centril

use pattern matching for slices destructuring

refs rust-lang#61542

Use slices pattern where it seems to make sense .
@awaitlink
Copy link
Contributor

Shouldn't this be closed because #61654 is now merged?

@oli-obk oli-obk closed this as completed Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants