fix underscore in slice patterns are removed (#3719)

This commit is contained in:
rChaser53 2019-07-31 23:55:58 +09:00 committed by Seiichi Uchida
parent aeb3496f31
commit 3b7a518144
2 changed files with 8 additions and 1 deletions

View File

@ -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))
}

View File

@ -0,0 +1,7 @@
fn main() {
let x: &[i32] = &[2, 2];
match x {
[_a, _] => println!("Wrong username or password"),
_ => println!("Logged in"),
}
}