diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-26 15:38:20 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-26 15:38:20 +0100 |
commit | 65e3fc8e772219bd41e182e424c928700788032a (patch) | |
tree | 97d219e21c2c4a873863e40103c7a1e5573ae5db /crates/ra_assists/src/assists/fill_match_arms.rs | |
parent | fa4ccc5fef4f69d2e5bc93086249ba4d2ecf9ffc (diff) | |
parent | 3126152a84e08a80659d49d735d03628154564ed (diff) |
Merge #2075
2075: document a couple of assists r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/assists/fill_match_arms.rs')
-rw-r--r-- | crates/ra_assists/src/assists/fill_match_arms.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_assists/src/assists/fill_match_arms.rs b/crates/ra_assists/src/assists/fill_match_arms.rs index e3f30b5de..13b98d033 100644 --- a/crates/ra_assists/src/assists/fill_match_arms.rs +++ b/crates/ra_assists/src/assists/fill_match_arms.rs | |||
@@ -7,6 +7,30 @@ use ra_syntax::ast::{self, edit::IndentLevel, make, AstNode, NameOwner}; | |||
7 | 7 | ||
8 | use crate::{Assist, AssistCtx, AssistId}; | 8 | use crate::{Assist, AssistCtx, AssistId}; |
9 | 9 | ||
10 | // Assist: fill_match_arms | ||
11 | // | ||
12 | // Adds missing clauses to a `match` expression. | ||
13 | // | ||
14 | // ``` | ||
15 | // enum Action { Move { distance: u32 }, Stop } | ||
16 | // | ||
17 | // fn handle(action: Action) { | ||
18 | // match action { | ||
19 | // <|> | ||
20 | // } | ||
21 | // } | ||
22 | // ``` | ||
23 | // -> | ||
24 | // ``` | ||
25 | // enum Action { Move { distance: u32 }, Stop } | ||
26 | // | ||
27 | // fn handle(action: Action) { | ||
28 | // match action { | ||
29 | // Action::Move{ distance } => (), | ||
30 | // Action::Stop => (), | ||
31 | // } | ||
32 | // } | ||
33 | // ``` | ||
10 | pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 34 | pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
11 | let match_expr = ctx.node_at_offset::<ast::MatchExpr>()?; | 35 | let match_expr = ctx.node_at_offset::<ast::MatchExpr>()?; |
12 | let match_arm_list = match_expr.match_arm_list()?; | 36 | let match_arm_list = match_expr.match_arm_list()?; |