diff options
author | Geoffrey Copin <[email protected]> | 2020-04-11 19:32:58 +0100 |
---|---|---|
committer | Geoffrey Copin <[email protected]> | 2020-04-11 19:32:58 +0100 |
commit | d9089245fefdc4179c1d61839e78131c5e5a5a45 (patch) | |
tree | ed4d0256459a116b4dcb90006056c255f7e4ad44 | |
parent | d362fcfc1c52f40a64a329e90b3f213afea0e6f5 (diff) |
Generate doc
-rw-r--r-- | crates/ra_assists/src/doc_tests/generated.rs | 15 | ||||
-rw-r--r-- | docs/user/assists.md | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs index 64444ee3a..6dc049715 100644 --- a/crates/ra_assists/src/doc_tests/generated.rs +++ b/crates/ra_assists/src/doc_tests/generated.rs | |||
@@ -607,6 +607,21 @@ impl Walrus { | |||
607 | } | 607 | } |
608 | 608 | ||
609 | #[test] | 609 | #[test] |
610 | fn doctest_reorder_fields() { | ||
611 | check( | ||
612 | "reorder_fields", | ||
613 | r#####" | ||
614 | struct Foo {foo: i32, bar: i32}; | ||
615 | const test: Foo = <|>Foo {bar: 0, foo: 1} | ||
616 | "#####, | ||
617 | r#####" | ||
618 | struct Foo {foo: i32, bar: i32}; | ||
619 | const test: Foo = Foo {foo: 1, bar: 0} | ||
620 | "#####, | ||
621 | ) | ||
622 | } | ||
623 | |||
624 | #[test] | ||
610 | fn doctest_replace_if_let_with_match() { | 625 | fn doctest_replace_if_let_with_match() { |
611 | check( | 626 | check( |
612 | "replace_if_let_with_match", | 627 | "replace_if_let_with_match", |
diff --git a/docs/user/assists.md b/docs/user/assists.md index 754131f6f..75404e289 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -582,6 +582,21 @@ impl Walrus { | |||
582 | } | 582 | } |
583 | ``` | 583 | ``` |
584 | 584 | ||
585 | ## `reorder_fields` | ||
586 | |||
587 | Reorder the fields of record literals and record patterns in the same order as in | ||
588 | the definition. | ||
589 | |||
590 | ```rust | ||
591 | // BEFORE | ||
592 | struct Foo {foo: i32, bar: i32}; | ||
593 | const test: Foo = ┃Foo {bar: 0, foo: 1} | ||
594 | |||
595 | // AFTER | ||
596 | struct Foo {foo: i32, bar: i32}; | ||
597 | const test: Foo = Foo {foo: 1, bar: 0} | ||
598 | ``` | ||
599 | |||
585 | ## `replace_if_let_with_match` | 600 | ## `replace_if_let_with_match` |
586 | 601 | ||
587 | Replaces `if let` with an else branch with a `match` expression. | 602 | Replaces `if let` with an else branch with a `match` expression. |