Skip to content

Commit ef9c4b6

Browse files
committed
move test case
1 parent a6a052f commit ef9c4b6

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

crates/ide_assists/src/handlers/replace_if_let_with_match.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,32 @@ fn main() {
574574
)
575575
}
576576

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+
577603
#[test]
578604
fn test_replace_match_with_if_let_unwraps_simple_expressions() {
579605
check_assist(
@@ -885,32 +911,6 @@ fn foo() {
885911
Bar(bar) => println!("bar {}", bar),
886912
}
887913
}
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-
}
914914
"#,
915915
);
916916
}

0 commit comments

Comments
 (0)