mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
Add documentation comment
This commit is contained in:
parent
270bcfdfc2
commit
25a0ce2e9e
1 changed files with 16 additions and 0 deletions
|
@ -16,6 +16,22 @@ use crate::{
|
||||||
};
|
};
|
||||||
use ra_syntax::ast::{Expr, NameRef};
|
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<Assist> {
|
pub(crate) fn reorder_fields(ctx: AssistCtx) -> Option<Assist> {
|
||||||
reorder::<RecordLit>(ctx.clone()).or_else(|| reorder::<RecordPat>(ctx))
|
reorder::<RecordLit>(ctx.clone()).or_else(|| reorder::<RecordPat>(ctx))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue