Skip to content

Commit d908924

Browse files
committed
Generate doc
1 parent d362fcf commit d908924

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

crates/ra_assists/src/doc_tests/generated.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,21 @@ impl Walrus {
606606
)
607607
}
608608

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+
609624
#[test]
610625
fn doctest_replace_if_let_with_match() {
611626
check(

docs/user/assists.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,21 @@ impl Walrus {
582582
}
583583
```
584584

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+
585600
## `replace_if_let_with_match`
586601

587602
Replaces `if let` with an else branch with a `match` expression.

0 commit comments

Comments
 (0)