mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
support TuplePat
This commit is contained in:
parent
a347cb5f86
commit
c955ea11b4
1 changed files with 20 additions and 0 deletions
|
@ -131,6 +131,11 @@ fn get_arm_types(context: &AssistContext, arm: &MatchArm) -> HashMap<String, Opt
|
||||||
recurse(&Some(field), map, ctx);
|
recurse(&Some(field), map, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some(ast::Pat::TuplePat(tuple)) => {
|
||||||
|
for field in tuple.fields() {
|
||||||
|
recurse(&Some(field), map, ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
Some(ast::Pat::RecordPat(record)) => {
|
Some(ast::Pat::RecordPat(record)) => {
|
||||||
if let Some(field_list) = record.record_pat_field_list() {
|
if let Some(field_list) = record.record_pat_field_list() {
|
||||||
for field in field_list.fields() {
|
for field in field_list.fields() {
|
||||||
|
@ -707,6 +712,21 @@ fn main(msg: Message) {
|
||||||
Message::ChangeColor(y, Color::Hsv(x, b, c)) => "",
|
Message::ChangeColor(y, Color::Hsv(x, b, c)) => "",
|
||||||
_ => "other"
|
_ => "other"
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn merge_match_arms_tuple() {
|
||||||
|
check_assist_not_applicable(
|
||||||
|
merge_match_arms,
|
||||||
|
r#"
|
||||||
|
fn func() {
|
||||||
|
match (0, "boo") {
|
||||||
|
(x, y) => $0"",
|
||||||
|
(y, x) => "",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue