add sourcegen

This commit is contained in:
crauzer 2021-10-06 20:23:22 +02:00
parent 05e58afde2
commit 765d7f20f9
2 changed files with 20 additions and 4 deletions

View File

@ -24,10 +24,10 @@
// ```
// ->
// ```
//let pat = match Some(true) {
// let pat = match Some(true) {
// Some(it) => it,
// None => return None,
//};
// };
// ```
pub(crate) fn replace_try_expr_with_match(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
let qm_kw = ctx.find_token_syntax_at_offset(T![?])?;

View File

@ -1720,6 +1720,22 @@ fn main() {
)
}
#[test]
fn doctest_replace_try_expr_with_match() {
check_doc_test(
"replace_try_expr_with_match",
r#####"
let pat = Some(true)$0?;
"#####,
r#####"
let pat = match Some(true) {
Some(it) => it,
None => return None,
};
"#####,
)
}
#[test]
fn doctest_sort_items() {
check_doc_test(