aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kolb <[email protected]>2020-05-25 18:35:52 +0100
committerJeremy Kolb <[email protected]>2020-05-25 18:35:52 +0100
commita5cc9a8a9ba1e6a0fc281e149881abdd3bd075c1 (patch)
tree8235c222a226ace40dc487c8d36a0fdfe6e40c3b
parent3c2c8d7e5f7887351bf8e475f441609527679e5f (diff)
Fix some clippy perf warnings
-rw-r--r--crates/ra_db/src/fixture.rs4
-rw-r--r--crates/ra_hir_def/src/lang_item.rs2
-rw-r--r--crates/ra_hir_ty/src/traits/builtin.rs3
-rw-r--r--crates/ra_ide/src/ssr.rs8
4 files changed, 8 insertions, 9 deletions
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs
index f6b50c67c..482a2f3e6 100644
--- a/crates/ra_db/src/fixture.rs
+++ b/crates/ra_db/src/fixture.rs
@@ -267,8 +267,8 @@ impl From<&FixtureMeta> for ParsedMeta {
267 ParsedMeta::Root { path: path.to_owned() } 267 ParsedMeta::Root { path: path.to_owned() }
268 } 268 }
269 FixtureMeta::File(f) => Self::File(FileMeta { 269 FixtureMeta::File(f) => Self::File(FileMeta {
270 path: f.path.to_owned().into(), 270 path: f.path.to_owned(),
271 krate: f.crate_name.to_owned().into(), 271 krate: f.crate_name.to_owned(),
272 deps: f.deps.to_owned(), 272 deps: f.deps.to_owned(),
273 cfg: f.cfg.to_owned(), 273 cfg: f.cfg.to_owned(),
274 edition: f 274 edition: f
diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs
index d962db3cc..3516784b8 100644
--- a/crates/ra_hir_def/src/lang_item.rs
+++ b/crates/ra_hir_def/src/lang_item.rs
@@ -164,7 +164,7 @@ impl LangItems {
164 T: Into<AttrDefId> + Copy, 164 T: Into<AttrDefId> + Copy,
165 { 165 {
166 if let Some(lang_item_name) = lang_attr(db, item) { 166 if let Some(lang_item_name) = lang_attr(db, item) {
167 self.items.entry(lang_item_name.clone()).or_insert_with(|| constructor(item)); 167 self.items.entry(lang_item_name).or_insert_with(|| constructor(item));
168 } 168 }
169 } 169 }
170} 170}
diff --git a/crates/ra_hir_ty/src/traits/builtin.rs b/crates/ra_hir_ty/src/traits/builtin.rs
index ccab246bf..88a422d2c 100644
--- a/crates/ra_hir_ty/src/traits/builtin.rs
+++ b/crates/ra_hir_ty/src/traits/builtin.rs
@@ -290,8 +290,7 @@ fn trait_object_unsize_impl_datum(
290 let self_trait_ref = TraitRef { trait_, substs: self_substs }; 290 let self_trait_ref = TraitRef { trait_, substs: self_substs };
291 let where_clauses = vec![GenericPredicate::Implemented(self_trait_ref)]; 291 let where_clauses = vec![GenericPredicate::Implemented(self_trait_ref)];
292 292
293 let impl_substs = 293 let impl_substs = Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.into())).build();
294 Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.clone().into())).build();
295 294
296 let trait_ref = TraitRef { trait_: unsize_trait, substs: impl_substs }; 295 let trait_ref = TraitRef { trait_: unsize_trait, substs: impl_substs };
297 296
diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs
index 1873d1d0d..130d3b4c3 100644
--- a/crates/ra_ide/src/ssr.rs
+++ b/crates/ra_ide/src/ssr.rs
@@ -196,10 +196,10 @@ fn find(pattern: &SsrPattern, code: &SyntaxNode) -> SsrMatches {
196 ) -> Option<Match> { 196 ) -> Option<Match> {
197 let match_ = check_opt_nodes(pattern.path(), code.path(), placeholders, match_)?; 197 let match_ = check_opt_nodes(pattern.path(), code.path(), placeholders, match_)?;
198 198
199 let mut pattern_fields = 199 let mut pattern_fields: Vec<RecordField> =
200 pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]); 200 pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or_default();
201 let mut code_fields = 201 let mut code_fields: Vec<RecordField> =
202 code.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]); 202 code.record_field_list().map(|x| x.fields().collect()).unwrap_or_default();
203 203
204 if pattern_fields.len() != code_fields.len() { 204 if pattern_fields.len() != code_fields.len() {
205 return None; 205 return None;