mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
ParenPat
This commit is contained in:
parent
c955ea11b4
commit
82d3238da8
1 changed files with 20 additions and 0 deletions
|
@ -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"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue