File tree Expand file tree Collapse file tree 1 file changed +26
-26
lines changed
crates/ide_assists/src/handlers Expand file tree Collapse file tree 1 file changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -574,6 +574,32 @@ fn main() {
574
574
)
575
575
}
576
576
577
+ #[ test]
578
+ fn nested_type ( ) {
579
+ check_assist (
580
+ replace_if_let_with_match,
581
+ r#"
582
+ //- minicore: result
583
+ fn foo(x: Result<i32, ()>) {
584
+ let bar: Result<_, ()> = Ok(Some(1));
585
+ $0if let Ok(Some(_)) = bar {
586
+ ()
587
+ } else {
588
+ ()
589
+ }
590
+ }
591
+ "# ,
592
+ r#"
593
+ fn foo(x: Result<i32, ()>) {
594
+ let bar: Result<_, ()> = Ok(Some(1));
595
+ match bar {
596
+ Ok(Some(_)) => (),
597
+ _ => (),
598
+ }
599
+ "# ,
600
+ ) ;
601
+ }
602
+
577
603
#[ test]
578
604
fn test_replace_match_with_if_let_unwraps_simple_expressions ( ) {
579
605
check_assist (
@@ -885,32 +911,6 @@ fn foo() {
885
911
Bar(bar) => println!("bar {}", bar),
886
912
}
887
913
}
888
- "# ,
889
- ) ;
890
- }
891
-
892
- #[ test]
893
- fn nested_type ( ) {
894
- check_assist (
895
- replace_if_let_with_match,
896
- r#"
897
- //- minicore: result
898
- fn foo(x: Result<i32, ()>) {
899
- let bar: Result<_, ()> = Ok(Some(1));
900
- $0if let Ok(Some(_)) = bar {
901
- ()
902
- } else {
903
- ()
904
- }
905
- }
906
- "# ,
907
- r#"
908
- fn foo(x: Result<i32, ()>) {
909
- let bar: Result<_, ()> = Ok(Some(1));
910
- match bar {
911
- Ok(Some(_)) => (),
912
- _ => (),
913
- }
914
914
"# ,
915
915
) ;
916
916
}
You can’t perform that action at this time.
0 commit comments