diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-11 19:40:46 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-11 19:40:46 +0100 |
commit | fd06fe7b13045185ab4e630b0044aa9d8bbcdf8a (patch) | |
tree | 1481f3fb3e65902b36571ad403fabf5e5940aa56 /crates/ra_assists/src/doc_tests | |
parent | 1a1c09ed3e3a34c0a8750f98ece9ad85595395d2 (diff) | |
parent | d9089245fefdc4179c1d61839e78131c5e5a5a45 (diff) |
Merge #3925
3925: Implement assist "Reorder field names" r=matklad a=geoffreycopin
This PR implements the "Reorder record fields" assist as discussed in issue #3821 .
Adding a `RecordFieldPat` variant to the `Pat` enum seemed like the easiest way to handle the `RecordPat` children as a single sequence of elements, maybe there is a better way ?
Co-authored-by: Geoffrey Copin <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/doc_tests')
-rw-r--r-- | crates/ra_assists/src/doc_tests/generated.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs index 24392836c..b63b4d81a 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", |