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

@ -917,7 +917,7 @@ impl LocalLspStore {
message: params.message,
actions: vec![],
response_channel: tx,
lsp_name: name.clone(),
lsp_name: name,
};
let _ = this.update(&mut cx, |_, cx| {
@ -2954,7 +2954,7 @@ impl LocalLspStore {
.update(cx, |this, cx| {
let path = buffer_to_edit.read(cx).project_path(cx);
let active_entry = this.active_entry;
let is_active_entry = path.clone().is_some_and(|project_path| {
let is_active_entry = path.is_some_and(|project_path| {
this.worktree_store
.read(cx)
.entry_for_path(&project_path, cx)
@ -5688,10 +5688,7 @@ impl LspStore {
let all_actions_task = self.request_multiple_lsp_locally(
buffer,
Some(range.start),
GetCodeActions {
range: range.clone(),
kinds: kinds.clone(),
},
GetCodeActions { range, kinds },
cx,
);
cx.background_spawn(async move {
@ -7221,7 +7218,7 @@ impl LspStore {
worktree = tree;
path = rel_path;
} else {
worktree = source_worktree.clone();
worktree = source_worktree;
path = relativize_path(&result.worktree_abs_path, &abs_path);
}
@ -10338,7 +10335,7 @@ impl LspStore {
let name = self
.language_server_statuses
.remove(&server_id)
.map(|status| status.name.clone())
.map(|status| status.name)
.or_else(|| {
if let Some(LanguageServerState::Running { adapter, .. }) = server_state.as_ref() {
Some(adapter.name())