From b22bd36f6e9cebd23eb09f6fdc5d89c9cfe44453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 7 Jan 2024 00:26:49 +0100 Subject: [PATCH] remove more redundant clones manually --- crates/hir-ty/src/infer/pat.rs | 1 - crates/hir/src/lib.rs | 1 - crates/ide/src/goto_definition.rs | 2 +- crates/ide/src/view_memory_layout.rs | 4 ++-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/hir-ty/src/infer/pat.rs b/crates/hir-ty/src/infer/pat.rs index 3fdd76f7cd4..1bf8babe836 100644 --- a/crates/hir-ty/src/infer/pat.rs +++ b/crates/hir-ty/src/infer/pat.rs @@ -233,7 +233,6 @@ impl InferenceContext<'_> { }; let mut expectations_iter = expectations .iter() - .cloned() .map(|a| a.assert_ty_ref(Interner).clone()) .chain(repeat_with(|| self.table.new_type_var())); diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 2428783161f..fd843945dfa 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -3673,7 +3673,6 @@ impl Closure { let (captures, _) = infer.closure_info(&self.id); captures .iter() - .cloned() .map(|capture| Type { env: db.trait_environment_for_body(owner), ty: capture.ty(&self.subst), diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index e0beba8fb38..d64295bdd69 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -79,7 +79,7 @@ pub(crate) fn goto_definition( return Some(vec![x]); } - if let Some(x) = try_lookup_macro_def_in_macro_use(sema, token.clone()) { + if let Some(x) = try_lookup_macro_def_in_macro_use(sema, token) { return Some(vec![x]); } } diff --git a/crates/ide/src/view_memory_layout.rs b/crates/ide/src/view_memory_layout.rs index 3802978f494..53f998e5457 100644 --- a/crates/ide/src/view_memory_layout.rs +++ b/crates/ide/src/view_memory_layout.rs @@ -69,7 +69,7 @@ impl FieldOrTupleIdx { .as_str() .map(|s| s.to_owned()) .unwrap_or_else(|| format!(".{}", f.name(db).as_tuple_index().unwrap())), - FieldOrTupleIdx::TupleIdx(i) => format!(".{i}").to_owned(), + FieldOrTupleIdx::TupleIdx(i) => format!(".{i}"), } } } @@ -203,7 +203,7 @@ pub(crate) fn view_memory_layout( let mut nodes = vec![MemoryLayoutNode { item_name, - typename: typename.clone(), + typename, size: layout.size(), offset: 0, alignment: layout.align(),