aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/doc_tests/generated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/doc_tests/generated.rs')
-rw-r--r--crates/ra_assists/src/doc_tests/generated.rs97
1 files changed, 97 insertions, 0 deletions
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs
index b96d5772e..09677af68 100644
--- a/crates/ra_assists/src/doc_tests/generated.rs
+++ b/crates/ra_assists/src/doc_tests/generated.rs
@@ -273,3 +273,100 @@ fn main() {
273"#####, 273"#####,
274 ) 274 )
275} 275}
276
277#[test]
278fn doctest_merge_match_arms() {
279 check(
280 "merge_match_arms",
281 r#####"
282enum Action { Move { distance: u32 }, Stop }
283
284fn handle(action: Action) {
285 match action {
286 <|>Action::Move(..) => foo(),
287 Action::Stop => foo(),
288 }
289}
290"#####,
291 r#####"
292enum Action { Move { distance: u32 }, Stop }
293
294fn handle(action: Action) {
295 match action {
296 Action::Move(..) | Action::Stop => foo(),
297 }
298}
299"#####,
300 )
301}
302
303#[test]
304fn doctest_move_arm_cond_to_match_guard() {
305 check(
306 "move_arm_cond_to_match_guard",
307 r#####"
308enum Action { Move { distance: u32 }, Stop }
309
310fn handle(action: Action) {
311 match action {
312 Action::Move { distance } => <|>if distance > 10 { foo() },
313 _ => (),
314 }
315}
316"#####,
317 r#####"
318enum Action { Move { distance: u32 }, Stop }
319
320fn handle(action: Action) {
321 match action {
322 Action::Move { distance } if distance > 10 => foo(),
323 _ => (),
324 }
325}
326"#####,
327 )
328}
329
330#[test]
331fn doctest_move_bounds_to_where_clause() {
332 check(
333 "move_bounds_to_where_clause",
334 r#####"
335fn apply<T, U, <|>F: FnOnce(T) -> U>(f: F, x: T) -> U {
336 f(x)
337}
338"#####,
339 r#####"
340fn apply<T, U, F>(f: F, x: T) -> U where F: FnOnce(T) -> U {
341 f(x)
342}
343"#####,
344 )
345}
346
347#[test]
348fn doctest_move_guard_to_arm_body() {
349 check(
350 "move_guard_to_arm_body",
351 r#####"
352enum Action { Move { distance: u32 }, Stop }
353
354fn handle(action: Action) {
355 match action {
356 Action::Move { distance } <|>if distance > 10 => foo(),
357 _ => (),
358 }
359}
360"#####,
361 r#####"
362enum Action { Move { distance: u32 }, Stop }
363
364fn handle(action: Action) {
365 match action {
366 Action::Move { distance } => if distance > 10 { foo() },
367 _ => (),
368 }
369}
370"#####,
371 )
372}