From 25a0ce2e9e59ca09665055c053d0008b7bbb9cb7 Mon Sep 17 00:00:00 2001 From: Geoffrey Copin Date: Sat, 11 Apr 2020 19:39:10 +0200 Subject: Add documentation comment --- crates/ra_assists/src/handlers/reorder_fields.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index 100e1feb1..661c1bf54 100644 --- a/crates/ra_assists/src/handlers/reorder_fields.rs +++ b/crates/ra_assists/src/handlers/reorder_fields.rs @@ -16,6 +16,22 @@ use crate::{ }; use ra_syntax::ast::{Expr, NameRef}; + +// Assist: reorder_fields +// +// Reorder the fields of record literals and record patterns in the same order as in +// the definition. +// +// ``` +// struct Foo {foo: i32, bar: i32}; +// const test: Foo = <|>Foo {bar: 0, foo: 1} +// ``` +// -> +// ``` +// struct Foo {foo: i32, bar: i32}; +// const test: Foo = <|>Foo {foo: 1, bar: 0} +// ``` +// pub(crate) fn reorder_fields(ctx: AssistCtx) -> Option { reorder::(ctx.clone()).or_else(|| reorder::(ctx)) } -- cgit v1.2.3