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:
parent
cf7c64d77f
commit
7bdc99abc1
306 changed files with 805 additions and 1102 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue