From 79d103d5b42c5b207c28b6eb8a6ab42f0c685ec5 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Fri, 5 Feb 2021 16:57:26 +0100 Subject: [PATCH] Remove redundant clones --- crates/assists/src/assist_context.rs | 4 ++-- crates/hir_def/src/body/lower.rs | 2 +- crates/hir_def/src/data.rs | 2 +- crates/hir_def/src/test_db.rs | 2 +- crates/hir_ty/src/diagnostics.rs | 2 +- crates/proc_macro_api/src/rpc.rs | 2 +- crates/test_utils/src/fixture.rs | 11 +---------- 7 files changed, 8 insertions(+), 17 deletions(-) diff --git a/crates/assists/src/assist_context.rs b/crates/assists/src/assist_context.rs index 8d93edba218..bba6c08e02d 100644 --- a/crates/assists/src/assist_context.rs +++ b/crates/assists/src/assist_context.rs @@ -162,7 +162,7 @@ fn add_impl(&mut self, mut assist: Assist, f: impl FnOnce(&mut AssistBuilder)) - } else { None }; - assist.source_change = source_change.clone(); + assist.source_change = source_change; self.buf.push(assist); Some(()) @@ -242,7 +242,7 @@ pub(crate) fn rewrite(&mut self, rewriter: SyntaxRewriter) { } pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into) { let file_system_edit = - FileSystemEdit::CreateFile { dst: dst.clone(), initial_contents: content.into() }; + FileSystemEdit::CreateFile { dst: dst, initial_contents: content.into() }; self.source_change.push_file_system_edit(file_system_edit); } diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 28b11cddeee..c18001e15dc 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -712,7 +712,7 @@ fn collect_block(&mut self, block: ast::BlockExpr) -> ExprId { let statements = block.statements().filter_map(|s| self.collect_stmt(s)).flatten().collect(); let tail = block.tail_expr().map(|e| self.collect_expr(e)); - let syntax_node_ptr = AstPtr::new(&block.clone().into()); + let syntax_node_ptr = AstPtr::new(&block.into()); let expr_id = self.alloc_expr( Expr::Block { id: block_id, statements, tail, label: None }, syntax_node_ptr, diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs index 42fcca386aa..d3380e0f44d 100644 --- a/crates/hir_def/src/data.rs +++ b/crates/hir_def/src/data.rs @@ -43,7 +43,7 @@ pub(crate) fn fn_data_query(db: &dyn DefDatabase, func: FunctionId) -> Arc Fixture { } } - Fixture { - path, - text: String::new(), - krate: krate, - deps, - cfg_atoms, - cfg_key_values, - edition, - env, - } + Fixture { path, text: String::new(), krate, deps, cfg_atoms, cfg_key_values, edition, env } } }