From 82d3238da8f6c33dc1beb07f3ec945d218615ab8 Mon Sep 17 00:00:00 2001 From: Jeroen Vannevel Date: Fri, 14 Jan 2022 00:39:44 +0000 Subject: [PATCH] ParenPat --- .../src/handlers/merge_match_arms.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/ide_assists/src/handlers/merge_match_arms.rs b/crates/ide_assists/src/handlers/merge_match_arms.rs index ff1804fe95..ecb7d4bf07 100644 --- a/crates/ide_assists/src/handlers/merge_match_arms.rs +++ b/crates/ide_assists/src/handlers/merge_match_arms.rs @@ -143,6 +143,9 @@ fn get_arm_types(context: &AssistContext, arm: &MatchArm) -> HashMap { + recurse(&parentheses.pat(), map, ctx); + } Some(ast::Pat::IdentPat(ident_pat)) => { if let Some(name) = ident_pat.name() { let pat_type = ctx.sema.type_of_pat(local_pat); @@ -727,6 +730,23 @@ fn func() { (x, y) => $0"", (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" + }; } "#, )