diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-21 06:12:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-21 06:12:36 +0000 |
commit | 1cbef27ff857803fbee123e6730b83e1ef154f6c (patch) | |
tree | 7d45ce377fb8f4c7019bb74381228b94f397110f /crates/ra_assists/src | |
parent | 6eab968c601637361e8fbd1ee93ded1b0d967bee (diff) | |
parent | 0d5d63a80ea08f2af439bcc72fff9b24d144c70d (diff) |
Merge #2625
2625: Clippy lints r=matklad a=kjeremy
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/assists/early_return.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_assists/src/assists/early_return.rs b/crates/ra_assists/src/assists/early_return.rs index 264412526..023917aca 100644 --- a/crates/ra_assists/src/assists/early_return.rs +++ b/crates/ra_assists/src/assists/early_return.rs | |||
@@ -83,8 +83,8 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Opt | |||
83 | let parent_container = parent_block.syntax().parent()?.parent()?; | 83 | let parent_container = parent_block.syntax().parent()?.parent()?; |
84 | 84 | ||
85 | let early_expression: ast::Expr = match parent_container.kind() { | 85 | let early_expression: ast::Expr = match parent_container.kind() { |
86 | WHILE_EXPR | LOOP_EXPR => make::expr_continue().into(), | 86 | WHILE_EXPR | LOOP_EXPR => make::expr_continue(), |
87 | FN_DEF => make::expr_return().into(), | 87 | FN_DEF => make::expr_return(), |
88 | _ => return None, | 88 | _ => return None, |
89 | }; | 89 | }; |
90 | 90 | ||
@@ -116,13 +116,13 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Opt | |||
116 | ) | 116 | ) |
117 | .into(), | 117 | .into(), |
118 | ), | 118 | ), |
119 | make::expr_path(make::path_from_name_ref(make::name_ref("it"))).into(), | 119 | make::expr_path(make::path_from_name_ref(make::name_ref("it"))), |
120 | ); | 120 | ); |
121 | 121 | ||
122 | let sad_arm = make::match_arm( | 122 | let sad_arm = make::match_arm( |
123 | // FIXME: would be cool to use `None` or `Err(_)` if appropriate | 123 | // FIXME: would be cool to use `None` or `Err(_)` if appropriate |
124 | once(make::placeholder_pat().into()), | 124 | once(make::placeholder_pat().into()), |
125 | early_expression.into(), | 125 | early_expression, |
126 | ); | 126 | ); |
127 | 127 | ||
128 | make::expr_match(cond_expr, make::match_arm_list(vec![happy_arm, sad_arm])) | 128 | make::expr_match(cond_expr, make::match_arm_list(vec![happy_arm, sad_arm])) |
@@ -130,7 +130,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Opt | |||
130 | 130 | ||
131 | let let_stmt = make::let_stmt( | 131 | let let_stmt = make::let_stmt( |
132 | make::bind_pat(make::name(&bound_ident.syntax().to_string())).into(), | 132 | make::bind_pat(make::name(&bound_ident.syntax().to_string())).into(), |
133 | Some(match_expr.into()), | 133 | Some(match_expr), |
134 | ); | 134 | ); |
135 | let let_stmt = if_indent_level.increase_indent(let_stmt); | 135 | let let_stmt = if_indent_level.increase_indent(let_stmt); |
136 | replace(let_stmt.syntax(), &then_block, &parent_block, &if_expr) | 136 | replace(let_stmt.syntax(), &then_block, &parent_block, &if_expr) |