diff options
author | Dawer <[email protected]> | 2021-04-17 11:20:29 +0100 |
---|---|---|
committer | Dawer <[email protected]> | 2021-04-17 11:20:29 +0100 |
commit | 76285f16deabe8175f0bfa9ebd913b9edef302f8 (patch) | |
tree | 6049090f555984beabe10a35136847586a7af33a /crates/ide_assists | |
parent | edbb1797fb16523f3d49b048b8d8ee8fe1c48c99 (diff) |
Test fill-match-arms assist: partial with wildcards
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/fill_match_arms.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/crates/ide_assists/src/handlers/fill_match_arms.rs b/crates/ide_assists/src/handlers/fill_match_arms.rs index e4794f17c..6408d7f0b 100644 --- a/crates/ide_assists/src/handlers/fill_match_arms.rs +++ b/crates/ide_assists/src/handlers/fill_match_arms.rs | |||
@@ -504,6 +504,40 @@ fn main() { | |||
504 | ); | 504 | ); |
505 | } | 505 | } |
506 | 506 | ||
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 | |||
507 | #[test] | 541 | #[test] |
508 | fn fill_match_arms_tuple_of_enum_not_applicable() { | 542 | fn fill_match_arms_tuple_of_enum_not_applicable() { |
509 | check_assist_not_applicable( | 543 | check_assist_not_applicable( |