From a5cc9a8a9ba1e6a0fc281e149881abdd3bd075c1 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Mon, 25 May 2020 13:35:52 -0400 Subject: Fix some clippy perf warnings --- crates/ra_db/src/fixture.rs | 4 ++-- crates/ra_hir_def/src/lang_item.rs | 2 +- crates/ra_hir_ty/src/traits/builtin.rs | 3 +-- crates/ra_ide/src/ssr.rs | 8 ++++---- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'crates') 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 { ParsedMeta::Root { path: path.to_owned() } } FixtureMeta::File(f) => Self::File(FileMeta { - path: f.path.to_owned().into(), - krate: f.crate_name.to_owned().into(), + path: f.path.to_owned(), + krate: f.crate_name.to_owned(), deps: f.deps.to_owned(), cfg: f.cfg.to_owned(), 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 { T: Into + Copy, { if let Some(lang_item_name) = lang_attr(db, item) { - self.items.entry(lang_item_name.clone()).or_insert_with(|| constructor(item)); + self.items.entry(lang_item_name).or_insert_with(|| constructor(item)); } } } 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( let self_trait_ref = TraitRef { trait_, substs: self_substs }; let where_clauses = vec![GenericPredicate::Implemented(self_trait_ref)]; - let impl_substs = - Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.clone().into())).build(); + let impl_substs = Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.into())).build(); let trait_ref = TraitRef { trait_: unsize_trait, substs: impl_substs }; 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 { ) -> Option { let match_ = check_opt_nodes(pattern.path(), code.path(), placeholders, match_)?; - let mut pattern_fields = - pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]); - let mut code_fields = - code.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]); + let mut pattern_fields: Vec = + pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or_default(); + let mut code_fields: Vec = + code.record_field_list().map(|x| x.fields().collect()).unwrap_or_default(); if pattern_fields.len() != code_fields.len() { return None; -- cgit v1.2.3