Fix false lint warnings in match arms with multiple patterns
fixing #13866
This commit is contained in:
parent
e454851813
commit
de92d42d4c
2 changed files with 67 additions and 21 deletions
|
@ -28,6 +28,13 @@ fn main() {
|
|||
match 30 {
|
||||
mut x => {} //~ ERROR: variable does not need to be mutable
|
||||
}
|
||||
match (30, 2) {
|
||||
(mut x, 1) | //~ ERROR: variable does not need to be mutable
|
||||
(mut x, 2) |
|
||||
(mut x, 3) => {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let x = |mut y: int| 10; //~ ERROR: variable does not need to be mutable
|
||||
fn what(mut foo: int) {} //~ ERROR: variable does not need to be mutable
|
||||
|
@ -50,6 +57,15 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
match (30, 2) {
|
||||
(mut x, 1) |
|
||||
(mut x, 2) |
|
||||
(mut x, 3) => {
|
||||
x = 21
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let x = |mut y: int| y = 32;
|
||||
fn nothing(mut foo: int) { foo = 37; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue