Skip to content

Commit 76285f1

Browse files
committed
Test fill-match-arms assist: partial with wildcards
1 parent edbb179 commit 76285f1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

crates/ide_assists/src/handlers/fill_match_arms.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,40 @@ fn main() {
504504
);
505505
}
506506

507+
// Fixme: This fails with extra useless match arms added.
508+
// To fix, it needs full fledged match exhaustiveness checking from
509+
// hir_ty::diagnostics::match_check
510+
// see https://github.com/rust-analyzer/rust-analyzer/issues/8493
511+
#[ignore]
512+
#[test]
513+
fn fill_match_arms_tuple_of_enum_partial_with_wildcards() {
514+
let ra_fixture = r#"
515+
fn main() {
516+
let a = Some(1);
517+
let b = Some(());
518+
match (a$0, b) {
519+
(Some(_), _) => {}
520+
(None, Some(_)) => {}
521+
}
522+
}
523+
"#;
524+
check_assist(
525+
fill_match_arms,
526+
&format!("//- /main.rs crate:main deps:core{}{}", ra_fixture, FamousDefs::FIXTURE),
527+
r#"
528+
fn main() {
529+
let a = Some(1);
530+
let b = Some(());
531+
match (a, b) {
532+
(Some(_), _) => {}
533+
(None, Some(_)) => {}
534+
$0(None, None) => {}
535+
}
536+
}
537+
"#,
538+
);
539+
}
540+
507541
#[test]
508542
fn fill_match_arms_tuple_of_enum_not_applicable() {
509543
check_assist_not_applicable(

0 commit comments

Comments
 (0)