Skip to content

Commit 3bb1b30

Browse files
committed
minor
1 parent 818aeb8 commit 3bb1b30

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/ra_assists/src/handlers/extract_variable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option
3737
return None;
3838
}
3939
let expr = node.ancestors().find_map(valid_target_expr)?;
40-
let (anchor_stmt, wrap_in_block) = anchor_stmt(expr.clone())?;
40+
let (anchor_stmt, wrap_in_block) = anchor_stmt(&expr)?;
4141
let indent = anchor_stmt.prev_sibling_or_token()?.as_token()?.clone();
4242
if indent.kind() != WHITESPACE {
4343
return None;
@@ -143,7 +143,7 @@ fn valid_target_expr(node: SyntaxNode) -> Option<ast::Expr> {
143143
/// to produce correct code.
144144
/// It can be a statement, the last in a block expression or a wanna be block
145145
/// expression like a lambda or match arm.
146-
fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> {
146+
fn anchor_stmt(expr: &ast::Expr) -> Option<(SyntaxNode, bool)> {
147147
expr.syntax().ancestors().find_map(|node| {
148148
if let Some(expr) = node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.expr()) {
149149
if expr.syntax() == &node {

0 commit comments

Comments
 (0)