Skip to content

Commit 388525f

Browse files
committed
Add test casee
1 parent 545b068 commit 388525f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

crates/ide_assists/src/handlers/replace_if_let_with_match.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,32 @@ fn foo() {
885885
Bar(bar) => println!("bar {}", bar),
886886
}
887887
}
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+
}
888914
"#,
889915
);
890916
}

0 commit comments

Comments
 (0)