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

@ -20,14 +20,14 @@ fn replace_deprecated_settings_values(
.nodes_for_capture_index(parent_object_capture_ix)
.next()?
.byte_range();
let parent_object_name = contents.get(parent_object_range.clone())?;
let parent_object_name = contents.get(parent_object_range)?;
let setting_name_ix = query.capture_index_for_name("setting_name")?;
let setting_name_range = mat
.nodes_for_capture_index(setting_name_ix)
.next()?
.byte_range();
let setting_name = contents.get(setting_name_range.clone())?;
let setting_name = contents.get(setting_name_range)?;
let setting_value_ix = query.capture_index_for_name("setting_value")?;
let setting_value_range = mat

View file

@ -279,7 +279,7 @@ fn rename_context_key(
new_predicate = new_predicate.replace(old_key, new_key);
}
if new_predicate != old_predicate {
Some((context_predicate_range, new_predicate.to_string()))
Some((context_predicate_range, new_predicate))
} else {
None
}

View file

@ -57,7 +57,7 @@ pub fn replace_edit_prediction_provider_setting(
.nodes_for_capture_index(parent_object_capture_ix)
.next()?
.byte_range();
let parent_object_name = contents.get(parent_object_range.clone())?;
let parent_object_name = contents.get(parent_object_range)?;
let setting_name_ix = query.capture_index_for_name("setting_name")?;
let setting_range = mat

View file

@ -25,7 +25,7 @@ fn replace_tab_close_button_setting_key(
.nodes_for_capture_index(parent_object_capture_ix)
.next()?
.byte_range();
let parent_object_name = contents.get(parent_object_range.clone())?;
let parent_object_name = contents.get(parent_object_range)?;
let setting_name_ix = query.capture_index_for_name("setting_name")?;
let setting_range = mat
@ -51,14 +51,14 @@ fn replace_tab_close_button_setting_value(
.nodes_for_capture_index(parent_object_capture_ix)
.next()?
.byte_range();
let parent_object_name = contents.get(parent_object_range.clone())?;
let parent_object_name = contents.get(parent_object_range)?;
let setting_name_ix = query.capture_index_for_name("setting_name")?;
let setting_name_range = mat
.nodes_for_capture_index(setting_name_ix)
.next()?
.byte_range();
let setting_name = contents.get(setting_name_range.clone())?;
let setting_name = contents.get(setting_name_range)?;
let setting_value_ix = query.capture_index_for_name("setting_value")?;
let setting_value_range = mat

View file

@ -19,7 +19,7 @@ fn replace_setting_value(
.nodes_for_capture_index(setting_capture_ix)
.next()?
.byte_range();
let setting_name = contents.get(setting_name_range.clone())?;
let setting_name = contents.get(setting_name_range)?;
if setting_name != "hide_mouse_while_typing" {
return None;

View file

@ -19,7 +19,7 @@ fn replace_preferred_completion_mode_value(
.nodes_for_capture_index(parent_object_capture_ix)
.next()?
.byte_range();
let parent_object_name = contents.get(parent_object_range.clone())?;
let parent_object_name = contents.get(parent_object_range)?;
if parent_object_name != "agent" {
return None;
@ -30,7 +30,7 @@ fn replace_preferred_completion_mode_value(
.nodes_for_capture_index(setting_name_capture_ix)
.next()?
.byte_range();
let setting_name = contents.get(setting_name_range.clone())?;
let setting_name = contents.get(setting_name_range)?;
if setting_name != "preferred_completion_mode" {
return None;