diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-26 17:12:17 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-26 17:12:17 +0100 |
commit | 568ef921acb8d35eed434089c1b1947c585c3f4c (patch) | |
tree | a3dfa55e7fadcb7e7e8299ce03d9f7beaee4a79b /crates/ra_assists/src/assists/flip_binexpr.rs | |
parent | 2f7d1f10c1614d9448604da5c105b75c43cc6f2b (diff) | |
parent | a5cbd8d5e8aca0d0d8dde175ba13bfa995a753c0 (diff) |
Merge #2077
2077: check style for assist docs r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/assists/flip_binexpr.rs')
-rw-r--r-- | crates/ra_assists/src/assists/flip_binexpr.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/crates/ra_assists/src/assists/flip_binexpr.rs b/crates/ra_assists/src/assists/flip_binexpr.rs index c51035282..3a1e5cbe1 100644 --- a/crates/ra_assists/src/assists/flip_binexpr.rs +++ b/crates/ra_assists/src/assists/flip_binexpr.rs | |||
@@ -1,11 +1,23 @@ | |||
1 | //! FIXME: write short doc here | ||
2 | |||
3 | use hir::db::HirDatabase; | 1 | use hir::db::HirDatabase; |
4 | use ra_syntax::ast::{AstNode, BinExpr, BinOp}; | 2 | use ra_syntax::ast::{AstNode, BinExpr, BinOp}; |
5 | 3 | ||
6 | use crate::{Assist, AssistCtx, AssistId}; | 4 | use crate::{Assist, AssistCtx, AssistId}; |
7 | 5 | ||
8 | /// Flip binary expression assist. | 6 | // Assist: flip_binexpr |
7 | // | ||
8 | // Flips operands of a binary expression. | ||
9 | // | ||
10 | // ``` | ||
11 | // fn main() { | ||
12 | // let _ = 90 +<|> 2; | ||
13 | // } | ||
14 | // ``` | ||
15 | // -> | ||
16 | // ``` | ||
17 | // fn main() { | ||
18 | // let _ = 2 + 90; | ||
19 | // } | ||
20 | // ``` | ||
9 | pub(crate) fn flip_binexpr(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 21 | pub(crate) fn flip_binexpr(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
10 | let expr = ctx.node_at_offset::<BinExpr>()?; | 22 | let expr = ctx.node_at_offset::<BinExpr>()?; |
11 | let lhs = expr.lhs()?.syntax().clone(); | 23 | let lhs = expr.lhs()?.syntax().clone(); |