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

unused_parens false-positive on mutable binding inside &-pattern #64064

Closed
sinkuu opened this issue Sep 1, 2019 · 1 comment
Closed

unused_parens false-positive on mutable binding inside &-pattern #64064

sinkuu opened this issue Sep 1, 2019 · 1 comment

Comments

@sinkuu
Copy link
Contributor

sinkuu commented Sep 1, 2019

for &(mut _x) in &[1, 2, 3] {
    // _x: mutable binding to a copied element
}

unused_parens suggests removing parens, but doing so will turn the pattern into a &mut pattern.

warning: unnecessary parentheses around pattern
 --> test.rs:2:10
  |
2 |     for &(mut _x) in &[1, 2, 3] {
  |          ^^^^^^^^ help: remove these parentheses
  |
@Centril
Copy link
Contributor

Centril commented Sep 1, 2019

Duplicate of #55342.

@Centril Centril closed this as completed Sep 1, 2019
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

2 participants