This commit is contained in:
Jeroen Vannevel 2022-01-14 00:39:44 +00:00
parent c955ea11b4
commit 82d3238da8
No known key found for this signature in database
GPG key ID: 78EF5F52F38C49BD

View file

@ -143,6 +143,9 @@ fn get_arm_types(context: &AssistContext, arm: &MatchArm) -> HashMap<String, Opt
} }
} }
} }
Some(ast::Pat::ParenPat(parentheses)) => {
recurse(&parentheses.pat(), map, ctx);
}
Some(ast::Pat::IdentPat(ident_pat)) => { Some(ast::Pat::IdentPat(ident_pat)) => {
if let Some(name) = ident_pat.name() { if let Some(name) = ident_pat.name() {
let pat_type = ctx.sema.type_of_pat(local_pat); let pat_type = ctx.sema.type_of_pat(local_pat);
@ -727,6 +730,23 @@ fn func() {
(x, y) => $0"", (x, y) => $0"",
(y, x) => "", (y, x) => "",
}; };
}
"#,
)
}
#[test]
fn merge_match_arms_parentheses() {
check_assist_not_applicable(
merge_match_arms,
r#"
fn func(x: i32) {
let variable = 2;
match x {
1 => $0"",
((((variable)))) => "",
_ => "other"
};
} }
"#, "#,
) )