diff options
author | Felix Kohlgrüber <[email protected]> | 2019-11-20 18:01:06 +0000 |
---|---|---|
committer | Felix Kohlgrüber <[email protected]> | 2019-11-20 18:01:06 +0000 |
commit | bcb2ea912bf96f38505c67a0b6896c6a5ac278ed (patch) | |
tree | 41a304a33955dd12d1f0ec127a80551367c8ffa0 /crates/ra_ide_api/src | |
parent | 7a5fd1f3f3c4a8f64407f9bd08a3d5e7f79417e0 (diff) |
fix 2190; add test for "replace if let with match"
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/join_lines.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/join_lines.rs b/crates/ra_ide_api/src/join_lines.rs index 6f71b27db..7deeb3494 100644 --- a/crates/ra_ide_api/src/join_lines.rs +++ b/crates/ra_ide_api/src/join_lines.rs | |||
@@ -244,6 +244,34 @@ fn foo(e: Result<U, V>) { | |||
244 | } | 244 | } |
245 | 245 | ||
246 | #[test] | 246 | #[test] |
247 | fn join_lines_multiline_in_block() { | ||
248 | check_join_lines( | ||
249 | r" | ||
250 | fn foo() { | ||
251 | match ty { | ||
252 | <|> Some(ty) => { | ||
253 | match ty { | ||
254 | _ => false, | ||
255 | } | ||
256 | } | ||
257 | _ => true, | ||
258 | } | ||
259 | } | ||
260 | ", | ||
261 | r" | ||
262 | fn foo() { | ||
263 | match ty { | ||
264 | <|> Some(ty) => match ty { | ||
265 | _ => false, | ||
266 | }, | ||
267 | _ => true, | ||
268 | } | ||
269 | } | ||
270 | ", | ||
271 | ); | ||
272 | } | ||
273 | |||
274 | #[test] | ||
247 | fn join_lines_keeps_comma_for_block_in_match_arm() { | 275 | fn join_lines_keeps_comma_for_block_in_match_arm() { |
248 | // We already have a comma | 276 | // We already have a comma |
249 | check_join_lines( | 277 | check_join_lines( |