From 1161fa45af0444166df8382ae4b0c9c6407e585b Mon Sep 17 00:00:00 2001 From: crauzer Date: Wed, 6 Oct 2021 20:45:18 +0200 Subject: [PATCH] fix tests --- .../src/handlers/replace_try_expr_with_match.rs | 17 +++++++++++------ crates/ide_assists/src/tests/generated.rs | 15 ++++++++++----- 2 files changed, 21 insertions(+), 11 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 084b977937..b8ec83cadd 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 @@ -20,14 +20,19 @@ use crate::assist_context::{AssistContext, Assists}; // Replaces a `try` expression with a `match` expression. // // ``` -// let pat = Some(true)$0?; +// # //- minicore:option +// fn handle() { +// let pat = Some(true)$0?; +// } // ``` // -> // ``` -// let pat = match Some(true) { -// Some(it) => it, -// None => return None, -// }; +// fn handle() { +// 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![?])?; @@ -93,7 +98,7 @@ mod tests { replace_try_expr_with_match, r#" fn test() { - let pat = 25$0; + let pat: u32 = 25$0; } "#, ); diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index e1af7dddfc..62c44d70e4 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -1725,13 +1725,18 @@ fn doctest_replace_try_expr_with_match() { check_doc_test( "replace_try_expr_with_match", r#####" -let pat = Some(true)$0?; +//- minicore:option +fn handle() { + let pat = Some(true)$0?; +} "#####, r#####" -let pat = match Some(true) { - Some(it) => it, - None => return None, -}; +fn handle() { + let pat = match Some(true) { + Some(it) => it, + None => return None, + }; +} "#####, ) }