aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-02-06 20:50:26 +0000
committerkjeremy <[email protected]>2019-02-06 20:50:26 +0000
commit6753051a45e067fb8267f7ecbbf1b894558718d1 (patch)
tree9da7f488f6564ac7f84d54ae9fc7296bcf2460e4 /crates/ra_assists/src
parentc1e10a24fa3ba2b03a738afd8e1f7f472a12e29f (diff)
Some clippy cleanups
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/introduce_variable.rs6
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
9use crate::{AssistCtx, Assist}; 9use crate::{AssistCtx, Assist};
10 10
11pub(crate) fn introduce_variable<'a>(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 11pub(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.
63fn valid_target_expr(node: &SyntaxNode) -> Option<&ast::Expr> { 63fn 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