diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-24 16:18:12 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-24 16:18:12 +0000 |
commit | bd4ea87f7442541123e3bbd7e17bfecdfb3c18c6 (patch) | |
tree | ef855bb9a4e77b2a99657e2e9ed3708c44ca104b /crates/ra_ide | |
parent | 49b9c8a0524e53f9bd75b50b6e87d7d88587629f (diff) | |
parent | f551e50c16d189a724885ce5f208595a31af49cc (diff) |
Merge #3294
3294: When joining lines, unwrap trivial diverging blocks r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/join_lines.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/ra_ide/src/join_lines.rs b/crates/ra_ide/src/join_lines.rs index 01fb32b3d..7d70dab9c 100644 --- a/crates/ra_ide/src/join_lines.rs +++ b/crates/ra_ide/src/join_lines.rs | |||
@@ -228,6 +228,31 @@ fn foo() { | |||
228 | } | 228 | } |
229 | 229 | ||
230 | #[test] | 230 | #[test] |
231 | fn test_join_lines_diverging_block() { | ||
232 | let before = r" | ||
233 | fn foo() { | ||
234 | loop { | ||
235 | match x { | ||
236 | 92 => <|>{ | ||
237 | continue; | ||
238 | } | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | "; | ||
243 | let after = r" | ||
244 | fn foo() { | ||
245 | loop { | ||
246 | match x { | ||
247 | 92 => <|>continue, | ||
248 | } | ||
249 | } | ||
250 | } | ||
251 | "; | ||
252 | check_join_lines(before, after); | ||
253 | } | ||
254 | |||
255 | #[test] | ||
231 | fn join_lines_adds_comma_for_block_in_match_arm() { | 256 | fn join_lines_adds_comma_for_block_in_match_arm() { |
232 | check_join_lines( | 257 | check_join_lines( |
233 | r" | 258 | r" |