Skip to content

Commit 25a0ce2

Browse files
committed
Add documentation comment
1 parent 270bcfd commit 25a0ce2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/ra_assists/src/handlers/reorder_fields.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ use crate::{
1616
};
1717
use ra_syntax::ast::{Expr, NameRef};
1818

19+
20+
// Assist: reorder_fields
21+
//
22+
// Reorder the fields of record literals and record patterns in the same order as in
23+
// the definition.
24+
//
25+
// ```
26+
// struct Foo {foo: i32, bar: i32};
27+
// const test: Foo = <|>Foo {bar: 0, foo: 1}
28+
// ```
29+
// ->
30+
// ```
31+
// struct Foo {foo: i32, bar: i32};
32+
// const test: Foo = <|>Foo {foo: 1, bar: 0}
33+
// ```
34+
//
1935
pub(crate) fn reorder_fields(ctx: AssistCtx) -> Option<Assist> {
2036
reorder::<RecordLit>(ctx.clone()).or_else(|| reorder::<RecordPat>(ctx))
2137
}

0 commit comments

Comments
 (0)