From 181184a350046a460441209fd34821c2c796b066 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 18 Jun 2021 23:28:37 +0300 Subject: minor: use minicore --- .../src/handlers/replace_unwrap_with_match.rs | 53 ++++++++++------------ 1 file changed, 25 insertions(+), 28 deletions(-) (limited to 'crates/ide_assists/src/handlers/replace_unwrap_with_match.rs') diff --git a/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs b/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs index a3bfa221c..7e57353c6 100644 --- a/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs +++ b/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs @@ -97,25 +97,24 @@ mod tests { fn test_replace_result_unwrap_with_match() { check_assist( replace_unwrap_with_match, - r" -enum Result { Ok(T), Err(E) } + r#" +//- minicore: result fn i(a: T) -> T { a } fn main() { - let x: Result = Result::Ok(92); + let x: Result = Ok(92); let y = i(x).$0unwrap(); } - ", - r" -enum Result { Ok(T), Err(E) } +"#, + r#" fn i(a: T) -> T { a } fn main() { - let x: Result = Result::Ok(92); + let x: Result = Ok(92); let y = match i(x) { Ok(it) => it, $0_ => unreachable!(), }; } - ", +"#, ) } @@ -123,25 +122,24 @@ fn main() { fn test_replace_option_unwrap_with_match() { check_assist( replace_unwrap_with_match, - r" -enum Option { Some(T), None } + r#" +//- minicore: option fn i(a: T) -> T { a } fn main() { - let x = Option::Some(92); + let x = Some(92); let y = i(x).$0unwrap(); } - ", - r" -enum Option { Some(T), None } +"#, + r#" fn i(a: T) -> T { a } fn main() { - let x = Option::Some(92); + let x = Some(92); let y = match i(x) { Some(it) => it, $0_ => unreachable!(), }; } - ", +"#, ); } @@ -149,25 +147,24 @@ fn main() { fn test_replace_result_unwrap_with_match_chaining() { check_assist( replace_unwrap_with_match, - r" -enum Result { Ok(T), Err(E) } + r#" +//- minicore: result fn i(a: T) -> T { a } fn main() { - let x: Result = Result::Ok(92); + let x: Result = Ok(92); let y = i(x).$0unwrap().count_zeroes(); } - ", - r" -enum Result { Ok(T), Err(E) } +"#, + r#" fn i(a: T) -> T { a } fn main() { - let x: Result = Result::Ok(92); + let x: Result = Ok(92); let y = match i(x) { Ok(it) => it, $0_ => unreachable!(), }.count_zeroes(); } - ", +"#, ) } @@ -175,14 +172,14 @@ fn main() { fn replace_unwrap_with_match_target() { check_assist_target( replace_unwrap_with_match, - r" -enum Option { Some(T), None } + r#" +//- minicore: option fn i(a: T) -> T { a } fn main() { - let x = Option::Some(92); + let x = Some(92); let y = i(x).$0unwrap(); } - ", +"#, r"i(x).unwrap()", ); } -- cgit v1.2.3