mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
fix underscore in slice patterns are removed (#3719)
This commit is contained in:
parent
aeb3496f31
commit
3b7a518144
@ -133,7 +133,7 @@ impl Rewrite for Pat {
|
||||
.iter()
|
||||
.map(|p| {
|
||||
if let Some(rw) = p.rewrite(context, shape) {
|
||||
format!("{}", if rw == "_" { "" } else { &rw })
|
||||
rw
|
||||
} else {
|
||||
format!("{}", context.snippet(p.span))
|
||||
}
|
||||
|
7
tests/target/issue-3718.rs
Normal file
7
tests/target/issue-3718.rs
Normal file
@ -0,0 +1,7 @@
|
||||
fn main() {
|
||||
let x: &[i32] = &[2, 2];
|
||||
match x {
|
||||
[_a, _] => println!("Wrong username or password"),
|
||||
_ => println!("Logged in"),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user