aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorYoshua Wuyts <[email protected]>2021-02-05 15:57:26 +0000
committerYoshua Wuyts <[email protected]>2021-02-05 15:57:26 +0000
commit79d103d5b42c5b207c28b6eb8a6ab42f0c685ec5 (patch)
treee996c0d19a90a51704d201e935f519b22644256e /crates
parentae7bee70a10d01f0fdebfc12c70aca4f765826b3 (diff)
Remove redundant clones
Diffstat (limited to 'crates')
-rw-r--r--crates/assists/src/assist_context.rs4
-rw-r--r--crates/hir_def/src/body/lower.rs2
-rw-r--r--crates/hir_def/src/data.rs2
-rw-r--r--crates/hir_def/src/test_db.rs2
-rw-r--r--crates/hir_ty/src/diagnostics.rs2
-rw-r--r--crates/proc_macro_api/src/rpc.rs2
-rw-r--r--crates/test_utils/src/fixture.rs11
7 files changed, 8 insertions, 17 deletions
diff --git a/crates/assists/src/assist_context.rs b/crates/assists/src/assist_context.rs
index 8d93edba2..bba6c08e0 100644
--- a/crates/assists/src/assist_context.rs
+++ b/crates/assists/src/assist_context.rs
@@ -162,7 +162,7 @@ impl Assists {
162 } else { 162 } else {
163 None 163 None
164 }; 164 };
165 assist.source_change = source_change.clone(); 165 assist.source_change = source_change;
166 166
167 self.buf.push(assist); 167 self.buf.push(assist);
168 Some(()) 168 Some(())
@@ -242,7 +242,7 @@ impl AssistBuilder {
242 } 242 }
243 pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) { 243 pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) {
244 let file_system_edit = 244 let file_system_edit =
245 FileSystemEdit::CreateFile { dst: dst.clone(), initial_contents: content.into() }; 245 FileSystemEdit::CreateFile { dst: dst, initial_contents: content.into() };
246 self.source_change.push_file_system_edit(file_system_edit); 246 self.source_change.push_file_system_edit(file_system_edit);
247 } 247 }
248 248
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index 28b11cdde..c18001e15 100644
--- a/crates/hir_def/src/body/lower.rs
+++ b/crates/hir_def/src/body/lower.rs
@@ -712,7 +712,7 @@ impl ExprCollector<'_> {
712 let statements = 712 let statements =
713 block.statements().filter_map(|s| self.collect_stmt(s)).flatten().collect(); 713 block.statements().filter_map(|s| self.collect_stmt(s)).flatten().collect();
714 let tail = block.tail_expr().map(|e| self.collect_expr(e)); 714 let tail = block.tail_expr().map(|e| self.collect_expr(e));
715 let syntax_node_ptr = AstPtr::new(&block.clone().into()); 715 let syntax_node_ptr = AstPtr::new(&block.into());
716 let expr_id = self.alloc_expr( 716 let expr_id = self.alloc_expr(
717 Expr::Block { id: block_id, statements, tail, label: None }, 717 Expr::Block { id: block_id, statements, tail, label: None },
718 syntax_node_ptr, 718 syntax_node_ptr,
diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs
index 42fcca386..d3380e0f4 100644
--- a/crates/hir_def/src/data.rs
+++ b/crates/hir_def/src/data.rs
@@ -43,7 +43,7 @@ impl FunctionData {
43 name: func.name.clone(), 43 name: func.name.clone(),
44 params: func.params.iter().map(|id| item_tree[*id].clone()).collect(), 44 params: func.params.iter().map(|id| item_tree[*id].clone()).collect(),
45 ret_type: item_tree[func.ret_type].clone(), 45 ret_type: item_tree[func.ret_type].clone(),
46 attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()).clone(), 46 attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()),
47 has_self_param: func.has_self_param, 47 has_self_param: func.has_self_param,
48 has_body: func.has_body, 48 has_body: func.has_body,
49 is_unsafe: func.is_unsafe, 49 is_unsafe: func.is_unsafe,
diff --git a/crates/hir_def/src/test_db.rs b/crates/hir_def/src/test_db.rs
index c4e36eda5..6665d902d 100644
--- a/crates/hir_def/src/test_db.rs
+++ b/crates/hir_def/src/test_db.rs
@@ -161,7 +161,7 @@ impl TestDB {
161 let node = src.map(|ptr| ptr.to_node(&root)); 161 let node = src.map(|ptr| ptr.to_node(&root));
162 let frange = node.as_ref().original_file_range(db); 162 let frange = node.as_ref().original_file_range(db);
163 163
164 let message = d.message().to_owned(); 164 let message = d.message();
165 actual.entry(frange.file_id).or_default().push((frange.range, message)); 165 actual.entry(frange.file_id).or_default().push((frange.range, message));
166 }); 166 });
167 167
diff --git a/crates/hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs
index 323c5f963..1b628d247 100644
--- a/crates/hir_ty/src/diagnostics.rs
+++ b/crates/hir_ty/src/diagnostics.rs
@@ -480,7 +480,7 @@ mod tests {
480 // FIXME: macros... 480 // FIXME: macros...
481 let file_id = src.file_id.original_file(&db); 481 let file_id = src.file_id.original_file(&db);
482 let range = src.value.to_node(&root).text_range(); 482 let range = src.value.to_node(&root).text_range();
483 let message = d.message().to_owned(); 483 let message = d.message();
484 actual.entry(file_id).or_default().push((range, message)); 484 actual.entry(file_id).or_default().push((range, message));
485 }); 485 });
486 486
diff --git a/crates/proc_macro_api/src/rpc.rs b/crates/proc_macro_api/src/rpc.rs
index cf830b59f..64cfdafc5 100644
--- a/crates/proc_macro_api/src/rpc.rs
+++ b/crates/proc_macro_api/src/rpc.rs
@@ -262,7 +262,7 @@ mod tests {
262 262
263 assert_eq!(task.macro_body, back.macro_body); 263 assert_eq!(task.macro_body, back.macro_body);
264 264
265 let result = ExpansionResult { expansion: tt.clone() }; 265 let result = ExpansionResult { expansion: tt };
266 let json = serde_json::to_string(&result).unwrap(); 266 let json = serde_json::to_string(&result).unwrap();
267 let back: ExpansionResult = serde_json::from_str(&json).unwrap(); 267 let back: ExpansionResult = serde_json::from_str(&json).unwrap();
268 268
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs
index e40b61a94..e3f57f3b2 100644
--- a/crates/test_utils/src/fixture.rs
+++ b/crates/test_utils/src/fixture.rs
@@ -95,16 +95,7 @@ impl Fixture {
95 } 95 }
96 } 96 }
97 97
98 Fixture { 98 Fixture { path, text: String::new(), krate, deps, cfg_atoms, cfg_key_values, edition, env }
99 path,
100 text: String::new(),
101 krate: krate,
102 deps,
103 cfg_atoms,
104 cfg_key_values,
105 edition,
106 env,
107 }
108 } 99 }
109} 100}
110 101