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/inline_local_variable.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/inline_local_variable.rs')
-rw-r--r-- | crates/ra_assists/src/assists/inline_local_variable.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/inline_local_variable.rs b/crates/ra_assists/src/assists/inline_local_variable.rs index 9bd64decc..1997781db 100644 --- a/crates/ra_assists/src/assists/inline_local_variable.rs +++ b/crates/ra_assists/src/assists/inline_local_variable.rs | |||
@@ -1,5 +1,3 @@ | |||
1 | //! FIXME: write short doc here | ||
2 | |||
3 | use hir::db::HirDatabase; | 1 | use hir::db::HirDatabase; |
4 | use ra_syntax::{ | 2 | use ra_syntax::{ |
5 | ast::{self, AstNode, AstToken}, | 3 | ast::{self, AstNode, AstToken}, |
@@ -9,6 +7,22 @@ use ra_syntax::{ | |||
9 | use crate::assist_ctx::AssistBuilder; | 7 | use crate::assist_ctx::AssistBuilder; |
10 | use crate::{Assist, AssistCtx, AssistId}; | 8 | use crate::{Assist, AssistCtx, AssistId}; |
11 | 9 | ||
10 | // Assist: inline_local_variable | ||
11 | // | ||
12 | // Inlines local variable. | ||
13 | // | ||
14 | // ``` | ||
15 | // fn main() { | ||
16 | // let x<|> = 1 + 2; | ||
17 | // x * 4; | ||
18 | // } | ||
19 | // ``` | ||
20 | // -> | ||
21 | // ``` | ||
22 | // fn main() { | ||
23 | // (1 + 2) * 4; | ||
24 | // } | ||
25 | // ``` | ||
12 | pub(crate) fn inline_local_varialbe(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 26 | pub(crate) fn inline_local_varialbe(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
13 | let let_stmt = ctx.node_at_offset::<ast::LetStmt>()?; | 27 | let let_stmt = ctx.node_at_offset::<ast::LetStmt>()?; |
14 | let bind_pat = match let_stmt.pat()? { | 28 | let bind_pat = match let_stmt.pat()? { |