diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-06 21:11:24 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-06 21:11:24 +0000 |
commit | a69ee774ca39f1300bd9dd7eb34b632db9098e26 (patch) | |
tree | 9da7f488f6564ac7f84d54ae9fc7296bcf2460e4 /crates/ra_assists | |
parent | c1e10a24fa3ba2b03a738afd8e1f7f472a12e29f (diff) | |
parent | 6753051a45e067fb8267f7ecbbf1b894558718d1 (diff) |
Merge #754
754: Some clippy things r=matklad a=kjeremy
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/introduce_variable.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs index c937a816c..f587b4fe6 100644 --- a/crates/ra_assists/src/introduce_variable.rs +++ b/crates/ra_assists/src/introduce_variable.rs | |||
@@ -8,7 +8,7 @@ use ra_syntax::{ | |||
8 | 8 | ||
9 | use crate::{AssistCtx, Assist}; | 9 | use crate::{AssistCtx, Assist}; |
10 | 10 | ||
11 | pub(crate) fn introduce_variable<'a>(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 11 | pub(crate) fn introduce_variable(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
12 | let node = ctx.covering_node(); | 12 | let node = ctx.covering_node(); |
13 | if !valid_covering_node(node) { | 13 | if !valid_covering_node(node) { |
14 | return None; | 14 | return None; |
@@ -61,13 +61,13 @@ fn valid_covering_node(node: &SyntaxNode) -> bool { | |||
61 | /// Check wether the node is a valid expression which can be extracted to a variable. | 61 | /// Check wether the node is a valid expression which can be extracted to a variable. |
62 | /// In general that's true for any expression, but in some cases that would produce invalid code. | 62 | /// In general that's true for any expression, but in some cases that would produce invalid code. |
63 | fn valid_target_expr(node: &SyntaxNode) -> Option<&ast::Expr> { | 63 | fn valid_target_expr(node: &SyntaxNode) -> Option<&ast::Expr> { |
64 | return match node.kind() { | 64 | match node.kind() { |
65 | PATH_EXPR => None, | 65 | PATH_EXPR => None, |
66 | BREAK_EXPR => ast::BreakExpr::cast(node).and_then(|e| e.expr()), | 66 | BREAK_EXPR => ast::BreakExpr::cast(node).and_then(|e| e.expr()), |
67 | RETURN_EXPR => ast::ReturnExpr::cast(node).and_then(|e| e.expr()), | 67 | RETURN_EXPR => ast::ReturnExpr::cast(node).and_then(|e| e.expr()), |
68 | LOOP_EXPR => ast::ReturnExpr::cast(node).and_then(|e| e.expr()), | 68 | LOOP_EXPR => ast::ReturnExpr::cast(node).and_then(|e| e.expr()), |
69 | _ => ast::Expr::cast(node), | 69 | _ => ast::Expr::cast(node), |
70 | }; | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | /// Returns the syntax node which will follow the freshly introduced var | 73 | /// Returns the syntax node which will follow the freshly introduced var |