mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Generate doc
This commit is contained in:
parent
d362fcfc1c
commit
d9089245fe
2 changed files with 30 additions and 0 deletions
|
@ -606,6 +606,21 @@ impl Walrus {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn doctest_reorder_fields() {
|
||||||
|
check(
|
||||||
|
"reorder_fields",
|
||||||
|
r#####"
|
||||||
|
struct Foo {foo: i32, bar: i32};
|
||||||
|
const test: Foo = <|>Foo {bar: 0, foo: 1}
|
||||||
|
"#####,
|
||||||
|
r#####"
|
||||||
|
struct Foo {foo: i32, bar: i32};
|
||||||
|
const test: Foo = Foo {foo: 1, bar: 0}
|
||||||
|
"#####,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn doctest_replace_if_let_with_match() {
|
fn doctest_replace_if_let_with_match() {
|
||||||
check(
|
check(
|
||||||
|
|
|
@ -582,6 +582,21 @@ impl Walrus {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `reorder_fields`
|
||||||
|
|
||||||
|
Reorder the fields of record literals and record patterns in the same order as in
|
||||||
|
the definition.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
// BEFORE
|
||||||
|
struct Foo {foo: i32, bar: i32};
|
||||||
|
const test: Foo = ┃Foo {bar: 0, foo: 1}
|
||||||
|
|
||||||
|
// AFTER
|
||||||
|
struct Foo {foo: i32, bar: i32};
|
||||||
|
const test: Foo = Foo {foo: 1, bar: 0}
|
||||||
|
```
|
||||||
|
|
||||||
## `replace_if_let_with_match`
|
## `replace_if_let_with_match`
|
||||||
|
|
||||||
Replaces `if let` with an else branch with a `match` expression.
|
Replaces `if let` with an else branch with a `match` expression.
|
||||||
|
|
Loading…
Reference in a new issue