Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
zed: Reduce clones (#30550)
tidely8000151aa948
diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rsindex a65eda5b40c..93b9a73d947 100644--- a/crates/agent/src/thread.rs+++ b/crates/agent/src/thread.rs@@ -2241,7 +2241,7 @@ impl Thread {.read(cx).enabled_tools(cx).iter()- .map(|tool| tool.name().to_string())+ .map(|tool| tool.name()).collect();self.message_feedback.insert(message_id, feedback);diff --git a/crates/agent/src/thread_store.rs b/crates/agent/src/thread_store.rsindex 99ecd3d4420..508ddfa0518 100644--- a/crates/agent/src/thread_store.rs+++ b/crates/agent/src/thread_store.rs@@ -486,8 +486,8 @@ impl ThreadStore {ToolSource::Native,&profile.tools- .iter()- .filter_map(|(tool, enabled)| enabled.then(|| tool.clone()))+ .into_iter()+ .filter_map(|(tool, enabled)| enabled.then(|| tool)).collect::<Vec<_>>(),cx,);@@ -511,32 +511,32 @@ impl ThreadStore {});}// Enable all the tools from all context servers, but disable the ones that are explicitly disabled- for (context_server_id, preset) in &profile.context_servers {+ for (context_server_id, preset) in profile.context_servers {self.tools.update(cx, |tools, cx| {tools.disable(ToolSource::ContextServer {- id: context_server_id.clone().into(),+ id: context_server_id.into(),},&preset.tools- .iter()- .filter_map(|(tool, enabled)| (!enabled).then(|| tool.clone()))+ .into_iter()+ .filter_map(|(tool, enabled)| (!enabled).then(|| tool)).collect::<Vec<_>>(),cx,)})}} else {- for (context_server_id, preset) in &profile.context_servers {+ for (context_server_id, preset) in profile.context_servers {self.tools.update(cx, |tools, cx| {tools.enable(ToolSource::ContextServer {- id: context_server_id.clone().into(),+ id: context_server_id.into(),},&preset.tools- .iter()- .filter_map(|(tool, enabled)| enabled.then(|| tool.clone()))+ .into_iter()+ .filter_map(|(tool, enabled)| enabled.then(|| tool)).collect::<Vec<_>>(),cx,)diff --git a/crates/assistant_context_editor/src/slash_command.rs b/crates/assistant_context_editor/src/slash_command.rsindex 1cbcb4a6379..b0f16e53a78 100644--- a/crates/assistant_context_editor/src/slash_command.rs+++ b/crates/assistant_context_editor/src/slash_command.rs@@ -278,8 +278,8 @@ impl CompletionProvider for SlashCommandCompletionProvider {buffer.anchor_after(Point::new(position.row, first_arg_start.start as u32));let arguments = call.arguments- .iter()- .filter_map(|argument| Some(line.get(argument.clone())?.to_string()))+ .into_iter()+ .filter_map(|argument| Some(line.get(argument)?.to_string())).collect::<Vec<_>>();let argument_range = first_arg_start..buffer_position;(diff --git a/crates/git_ui/src/branch_picker.rs b/crates/git_ui/src/branch_picker.rsindex 2530bacf8d7..04c5575d1fd 100644--- a/crates/git_ui/src/branch_picker.rs+++ b/crates/git_ui/src/branch_picker.rs@@ -306,8 +306,7 @@ impl PickerDelegate for BranchListDelegate {cx.background_executor().clone(),).await- .iter()- .cloned()+ .into_iter().map(|candidate| BranchEntry {branch: all_branches[candidate.candidate_id].clone(),positions: candidate.positions,diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rsindex 738e0f62a3e..03acd514a1d 100644--- a/crates/git_ui/src/git_panel.rs+++ b/crates/git_ui/src/git_panel.rs@@ -1051,8 +1051,8 @@ impl GitPanel {repo.checkout_files("HEAD",entries- .iter()- .map(|entries| entries.repo_path.clone())+ .into_iter()+ .map(|entries| entries.repo_path).collect(),cx,)diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rsindex 296b169950d..fd25823307b 100644--- a/crates/inline_completion_button/src/inline_completion_button.rs+++ b/crates/inline_completion_button/src/inline_completion_button.rs@@ -857,7 +857,7 @@ async fn open_disabled_globs_setting_in_editor(});if !edits.is_empty() {- item.edit(edits.iter().cloned(), cx);+ item.edit(edits, cx);}let text = item.buffer().read(cx).snapshot(cx).text();diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rsindex 8b29ab6298e..9c124599b2f 100644--- a/crates/language_tools/src/lsp_log.rs+++ b/crates/language_tools/src/lsp_log.rs@@ -1238,12 +1238,12 @@ impl Render for LspLogToolbarItemView {}});let available_language_servers: Vec<_> = menu_rows- .iter()+ .into_iter().map(|row| {(row.server_id,- row.server_name.clone(),- row.worktree_root_name.clone(),+ row.server_name,+ row.worktree_root_name,row.selected_entry,)})diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rsindex d00f0a41fdf..5d6fcdb5033 100644--- a/crates/project/src/git_store.rs+++ b/crates/project/src/git_store.rs@@ -4278,9 +4278,9 @@ impl Repository {}));}let mut cursor = prev_statuses.cursor::<PathProgress>(&());- for path in changed_paths.iter() {+ for path in changed_paths.into_iter() {if cursor.seek_forward(&PathTarget::Path(&path), Bias::Left, &()) {- changed_path_statuses.push(Edit::Remove(PathKey(path.0.clone())));+ changed_path_statuses.push(Edit::Remove(PathKey(path.0)));}}changed_path_statuses