about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2020-07-21 17:50:10 +0200
committerAleksey Kladov <aleksey.kladov@gmail.com>2020-07-21 17:50:19 +0200
commit3bb1b3070a51d5bd0ddffff85069260d3f83207d (patch)
tree5e1d84d1119d9b7d848456f6c331c0f78c1597c5
parent818aeb8a242bba5d8947ce2960e1af27d998f4fc (diff)
downloadrust-3bb1b3070a51d5bd0ddffff85069260d3f83207d.tar.gz
rust-3bb1b3070a51d5bd0ddffff85069260d3f83207d.zip
minor
-rw-r--r--crates/ra_assists/src/handlers/extract_variable.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/handlers/extract_variable.rs b/crates/ra_assists/src/handlers/extract_variable.rs
index 481baf1a40a..f5637a74048 100644
--- a/crates/ra_assists/src/handlers/extract_variable.rs
+++ b/crates/ra_assists/src/handlers/extract_variable.rs
@@ -37,7 +37,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option
         return None;
     }
     let expr = node.ancestors().find_map(valid_target_expr)?;
-    let (anchor_stmt, wrap_in_block) = anchor_stmt(expr.clone())?;
+    let (anchor_stmt, wrap_in_block) = anchor_stmt(&expr)?;
     let indent = anchor_stmt.prev_sibling_or_token()?.as_token()?.clone();
     if indent.kind() != WHITESPACE {
         return None;
@@ -143,7 +143,7 @@ fn valid_target_expr(node: SyntaxNode) -> Option<ast::Expr> {
 /// to produce correct code.
 /// It can be a statement, the last in a block expression or a wanna be block
 /// expression like a lambda or match arm.
-fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> {
+fn anchor_stmt(expr: &ast::Expr) -> Option<(SyntaxNode, bool)> {
     expr.syntax().ancestors().find_map(|node| {
         if let Some(expr) = node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.expr()) {
             if expr.syntax() == &node {