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

@ -119,7 +119,7 @@ impl EditNicknameState {
let starting_text = SshSettings::get_global(cx)
.ssh_connections()
.nth(index)
.and_then(|state| state.nickname.clone())
.and_then(|state| state.nickname)
.filter(|text| !text.is_empty());
this.editor.update(cx, |this, cx| {
this.set_placeholder_text("Add a nickname for this server", cx);
@ -165,7 +165,7 @@ impl ProjectPicker {
let nickname = connection.nickname.clone().map(|nick| nick.into());
let _path_task = cx
.spawn_in(window, {
let workspace = workspace.clone();
let workspace = workspace;
async move |this, cx| {
let Ok(Some(paths)) = rx.await else {
workspace
@ -520,7 +520,7 @@ impl RemoteServerProjects {
self.mode = Mode::CreateRemoteServer(CreateRemoteServer {
address_editor: editor,
address_error: None,
ssh_prompt: Some(ssh_prompt.clone()),
ssh_prompt: Some(ssh_prompt),
_creating: Some(creating),
});
}
@ -843,7 +843,7 @@ impl RemoteServerProjects {
.start_slot(Icon::new(IconName::Plus).color(Color::Muted))
.child(Label::new("Open Folder"))
.on_click(cx.listener({
let ssh_connection = connection.clone();
let ssh_connection = connection;
let host = host.clone();
move |this, _, window, cx| {
let new_ix = this.create_host_from_ssh_config(&host, cx);
@ -1376,7 +1376,7 @@ impl RemoteServerProjects {
};
let connection_string = connection.host.clone();
let nickname = connection.nickname.clone().map(|s| s.into());
let nickname = connection.nickname.map(|s| s.into());
v_flex()
.id("ssh-edit-nickname")

View file

@ -681,7 +681,7 @@ pub async fn open_ssh_project(
window
.update(cx, |workspace, _, cx| {
if let Some(client) = workspace.project().read(cx).ssh_client().clone() {
if let Some(client) = workspace.project().read(cx).ssh_client() {
ExtensionStore::global(cx)
.update(cx, |store, cx| store.register_ssh_client(client, cx));
}