Fix clippy::redundant_clone lint violations (#36558)

This removes around 900 unnecessary clones, ranging from cloning a few
ints all the way to large data structures and images.

A lot of these were fixed using `cargo clippy --fix --workspace
--all-targets`, however it often breaks other lints and needs to be run
again. This was then followed up with some manual fixing.

I understand this is a large diff, but all the changes are pretty
trivial. Rust is doing some heavy lifting here for us. Once I get it up
to speed with main, I'd appreciate this getting merged rather sooner
than later.

Release Notes:

- N/A
This commit is contained in:
tidely 2025-08-20 13:20:13 +03:00 committed by GitHub
parent cf7c64d77f
commit 7bdc99abc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
306 changed files with 805 additions and 1102 deletions

View file

@ -903,7 +903,7 @@ impl AppState {
let languages = Arc::new(LanguageRegistry::test(cx.background_executor().clone()));
let clock = Arc::new(clock::FakeSystemClock::new());
let http_client = http_client::FakeHttpClient::with_404_response();
let client = Client::new(clock, http_client.clone(), cx);
let client = Client::new(clock, http_client, cx);
let session = cx.new(|cx| AppSession::new(Session::test(), cx));
let user_store = cx.new(|cx| UserStore::new(client.clone(), cx));
let workspace_store = cx.new(|cx| WorkspaceStore::new(client.clone(), cx));
@ -1323,7 +1323,6 @@ impl Workspace {
let mut active_call = None;
if let Some(call) = ActiveCall::try_global(cx) {
let call = call.clone();
let subscriptions = vec![cx.subscribe_in(&call, window, Self::on_active_call_event)];
active_call = Some((call, subscriptions));
}
@ -4116,7 +4115,6 @@ impl Workspace {
.unwrap_or_else(|| {
self.split_pane(self.active_pane.clone(), SplitDirection::Right, window, cx)
})
.clone()
}
pub fn pane_for(&self, handle: &dyn ItemHandle) -> Option<Entity<Pane>> {
@ -6713,7 +6711,7 @@ impl WorkspaceStore {
.update(cx, |workspace, window, cx| {
let handler_response =
workspace.handle_follow(follower.project_id, window, cx);
if let Some(active_view) = handler_response.active_view.clone()
if let Some(active_view) = handler_response.active_view
&& workspace.project.read(cx).remote_id() == follower.project_id
{
response.active_view = Some(active_view)