parent
488c0b9546
commit
548de69d2d
2 changed files with 59 additions and 47 deletions
|
@ -260,8 +260,8 @@ fn rewrite_tuple_pat(pats: &[ptr::P<ast::Pat>],
|
|||
}
|
||||
|
||||
if pat_vec.is_empty() {
|
||||
path_str
|
||||
} else {
|
||||
return Some(format!("{}()", try_opt!(path_str)));
|
||||
}
|
||||
// add comma if `(x,)`
|
||||
let add_comma = path_str.is_none() && pat_vec.len() == 1 && dotdot_pos.is_none();
|
||||
|
||||
|
@ -310,7 +310,6 @@ fn rewrite_tuple_pat(pats: &[ptr::P<ast::Pat>],
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn count_wildcard_suffix_len(items: &[ListItem]) -> usize {
|
||||
|
|
13
tests/target/empty-tuple-no-conversion-to-unit-struct.rs
Normal file
13
tests/target/empty-tuple-no-conversion-to-unit-struct.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
enum TestEnum {
|
||||
Arm1(),
|
||||
Arm2,
|
||||
}
|
||||
|
||||
|
||||
fn foo() {
|
||||
let test = TestEnum::Arm1;
|
||||
match test {
|
||||
TestEnum::Arm1() => {}
|
||||
TestEnum::Arm2 => {}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue