We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 270bcfd commit 25a0ce2Copy full SHA for 25a0ce2
crates/ra_assists/src/handlers/reorder_fields.rs
@@ -16,6 +16,22 @@ use crate::{
16
};
17
use ra_syntax::ast::{Expr, NameRef};
18
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
32
+// const test: Foo = <|>Foo {foo: 1, bar: 0}
33
34
35
pub(crate) fn reorder_fields(ctx: AssistCtx) -> Option<Assist> {
36
reorder::<RecordLit>(ctx.clone()).or_else(|| reorder::<RecordPat>(ctx))
37
}
0 commit comments