From 765d7f20f90608e8beb55c0210d71c9b26a3cbb6 Mon Sep 17 00:00:00 2001 From: crauzer Date: Wed, 6 Oct 2021 20:23:22 +0200 Subject: [PATCH] add sourcegen --- .../src/handlers/replace_try_expr_with_match.rs | 8 ++++---- crates/ide_assists/src/tests/generated.rs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/crates/ide_assists/src/handlers/replace_try_expr_with_match.rs b/crates/ide_assists/src/handlers/replace_try_expr_with_match.rs index 6fb784b7f4a..084b977937c 100644 --- a/crates/ide_assists/src/handlers/replace_try_expr_with_match.rs +++ b/crates/ide_assists/src/handlers/replace_try_expr_with_match.rs @@ -24,10 +24,10 @@ // ``` // -> // ``` -//let pat = match Some(true) { -// Some(it) => it, -// None => return None, -//}; +// 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![?])?; diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index 1daf96b827b..e1af7dddfc1 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -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(