File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
crates/ra_assists/src/doc_tests Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff 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]
610625fn doctest_replace_if_let_with_match ( ) {
611626 check (
Original file line number Diff line number Diff 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
587602Replaces ` if let ` with an else branch with a ` match ` expression.
You can’t perform that action at this time.
0 commit comments