aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/assists/fill_match_arms.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-26 15:38:20 +0100
committerGitHub <[email protected]>2019-10-26 15:38:20 +0100
commit65e3fc8e772219bd41e182e424c928700788032a (patch)
tree97d219e21c2c4a873863e40103c7a1e5573ae5db /crates/ra_assists/src/assists/fill_match_arms.rs
parentfa4ccc5fef4f69d2e5bc93086249ba4d2ecf9ffc (diff)
parent3126152a84e08a80659d49d735d03628154564ed (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.rs24
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
8use crate::{Assist, AssistCtx, AssistId}; 8use 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// ```
10pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 34pub(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()?;