From dd7fce3f5e3cae7c2e4681671ea00344369ceece Mon Sep 17 00:00:00 2001 From: tidely <43219534+tidely@users.noreply.github.com> Date: Tue, 5 Aug 2025 23:49:41 +0300 Subject: [PATCH] workspace: Remove excess clones (#35664) Removes a few excess clones I found. Minor formatting change by utilizing `map_or` Release Notes: - N/A --- crates/workspace/src/workspace.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 63953ff802..6572574ce1 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1813,10 +1813,7 @@ impl Workspace { .max_by(|b1, b2| b1.worktree_id.cmp(&b2.worktree_id)) }); - match latest_project_path_opened { - Some(latest_project_path_opened) => latest_project_path_opened == history_path, - None => true, - } + latest_project_path_opened.map_or(true, |path| path == history_path) }) } @@ -4796,7 +4793,7 @@ impl Workspace { .remote_id(&self.app_state.client, window, cx) .map(|id| id.to_proto()); - if let Some(id) = id.clone() { + if let Some(id) = id { if let Some(variant) = item.to_state_proto(window, cx) { let view = Some(proto::View { id: id.clone(), @@ -4809,7 +4806,7 @@ impl Workspace { update = proto::UpdateActiveView { view, // TODO: Remove after version 0.145.x stabilizes. - id: id.clone(), + id, leader_id: leader_peer_id, }; }