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 12:20:13 +02:00
committed by GitHub
parent cf7c64d77f
commit 7bdc99abc1
306 changed files with 805 additions and 1102 deletions
+1 -17
View File
@@ -3593,7 +3593,7 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
let abs_path = project_a.read_with(cx_a, |project, cx| {
project
.absolute_path(&project_path, cx)
.map(|path_buf| Arc::from(path_buf.to_owned()))
.map(Arc::from)
.unwrap()
});
@@ -3647,20 +3647,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
assert_eq!(1, breakpoints_a.len());
@@ -3680,20 +3676,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
assert_eq!(1, breakpoints_a.len());
@@ -3713,20 +3705,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
assert_eq!(1, breakpoints_a.len());
@@ -3746,20 +3734,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
editor
.breakpoint_store()
.clone()
.unwrap()
.read(cx)
.all_source_breakpoints(cx)
.clone()
});
assert_eq!(0, breakpoints_a.len());
@@ -266,7 +266,7 @@ impl RandomizedTest for RandomChannelBufferTest {
"client {user_id} has different text than client {prev_user_id} for channel {channel_name}",
);
} else {
prev_text = Some((user_id, text.clone()));
prev_text = Some((user_id, text));
}
// Assert that all clients and the server agree about who is present in the
@@ -643,7 +643,7 @@ impl RandomizedTest for ProjectCollaborationTest {
);
let project = project.await?;
client.dev_server_projects_mut().push(project.clone());
client.dev_server_projects_mut().push(project);
}
ClientOperation::CreateWorktreeEntry {
+2 -2
View File
@@ -370,8 +370,8 @@ impl TestServer {
let client = TestClient {
app_state,
username: name.to_string(),
channel_store: cx.read(ChannelStore::global).clone(),
notification_store: cx.read(NotificationStore::global).clone(),
channel_store: cx.read(ChannelStore::global),
notification_store: cx.read(NotificationStore::global),
state: Default::default(),
};
client.wait_for_current_user(cx).await;