diff options
Diffstat (limited to 'crates/ra_assists/src/introduce_variable.rs')
-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 |