diff options
Diffstat (limited to 'crates/ide_assists/src/handlers')
-rw-r--r-- | crates/ide_assists/src/handlers/fill_match_arms.rs | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/crates/ide_assists/src/handlers/fill_match_arms.rs b/crates/ide_assists/src/handlers/fill_match_arms.rs index 5a43bdd6f..cd0f6dba9 100644 --- a/crates/ide_assists/src/handlers/fill_match_arms.rs +++ b/crates/ide_assists/src/handlers/fill_match_arms.rs | |||
@@ -278,8 +278,6 @@ fn build_pat(db: &RootDatabase, module: hir::Module, var: ExtendedVariant) -> Op | |||
278 | 278 | ||
279 | #[cfg(test)] | 279 | #[cfg(test)] |
280 | mod tests { | 280 | mod tests { |
281 | use ide_db::helpers::FamousDefs; | ||
282 | |||
283 | use crate::tests::{ | 281 | use crate::tests::{ |
284 | check_assist, check_assist_not_applicable, check_assist_target, check_assist_unresolved, | 282 | check_assist, check_assist_not_applicable, check_assist_target, check_assist_unresolved, |
285 | }; | 283 | }; |
@@ -716,7 +714,10 @@ fn main() { | |||
716 | 714 | ||
717 | #[test] | 715 | #[test] |
718 | fn fill_match_arms_tuple_of_enum_partial_with_wildcards() { | 716 | fn fill_match_arms_tuple_of_enum_partial_with_wildcards() { |
719 | let ra_fixture = r#" | 717 | check_assist( |
718 | fill_match_arms, | ||
719 | r#" | ||
720 | //- minicore: option | ||
720 | fn main() { | 721 | fn main() { |
721 | let a = Some(1); | 722 | let a = Some(1); |
722 | let b = Some(()); | 723 | let b = Some(()); |
@@ -725,10 +726,7 @@ fn main() { | |||
725 | (None, Some(_)) => {} | 726 | (None, Some(_)) => {} |
726 | } | 727 | } |
727 | } | 728 | } |
728 | "#; | 729 | "#, |
729 | check_assist( | ||
730 | fill_match_arms, | ||
731 | &format!("//- /main.rs crate:main deps:core{}{}", ra_fixture, FamousDefs::FIXTURE), | ||
732 | r#" | 730 | r#" |
733 | fn main() { | 731 | fn main() { |
734 | let a = Some(1); | 732 | let a = Some(1); |
@@ -746,17 +744,17 @@ fn main() { | |||
746 | #[test] | 744 | #[test] |
747 | fn fill_match_arms_partial_with_deep_pattern() { | 745 | fn fill_match_arms_partial_with_deep_pattern() { |
748 | // Fixme: cannot handle deep patterns | 746 | // Fixme: cannot handle deep patterns |
749 | let ra_fixture = r#" | 747 | check_assist_not_applicable( |
748 | fill_match_arms, | ||
749 | r#" | ||
750 | //- minicore: option | ||
750 | fn main() { | 751 | fn main() { |
751 | match $0Some(true) { | 752 | match $0Some(true) { |
752 | Some(true) => {} | 753 | Some(true) => {} |
753 | None => {} | 754 | None => {} |
754 | } | 755 | } |
755 | } | 756 | } |
756 | "#; | 757 | "#, |
757 | check_assist_not_applicable( | ||
758 | fill_match_arms, | ||
759 | &format!("//- /main.rs crate:main deps:core{}{}", ra_fixture, FamousDefs::FIXTURE), | ||
760 | ); | 758 | ); |
761 | } | 759 | } |
762 | 760 | ||
@@ -1007,17 +1005,15 @@ fn foo(a: A) { | |||
1007 | #[test] | 1005 | #[test] |
1008 | fn option_order() { | 1006 | fn option_order() { |
1009 | cov_mark::check!(option_order); | 1007 | cov_mark::check!(option_order); |
1010 | let before = r#" | 1008 | check_assist( |
1009 | fill_match_arms, | ||
1010 | r#" | ||
1011 | //- minicore: option | ||
1011 | fn foo(opt: Option<i32>) { | 1012 | fn foo(opt: Option<i32>) { |
1012 | match opt$0 { | 1013 | match opt$0 { |
1013 | } | 1014 | } |
1014 | } | 1015 | } |
1015 | "#; | 1016 | "#, |
1016 | let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE); | ||
1017 | |||
1018 | check_assist( | ||
1019 | fill_match_arms, | ||
1020 | before, | ||
1021 | r#" | 1017 | r#" |
1022 | fn foo(opt: Option<i32>) { | 1018 | fn foo(opt: Option<i32>) { |
1023 | match opt { | 1019 | match opt { |