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

@ -126,7 +126,7 @@ fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement
.gap_1()
.child(
h_flex()
.id(name.clone())
.id(name)
.relative()
.w_full()
.border_2()
@ -201,7 +201,7 @@ fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement
});
} else {
let appearance = *SystemAppearance::global(cx);
settings.set_theme(theme.clone(), appearance);
settings.set_theme(theme, appearance);
}
});
}

View file

@ -104,7 +104,7 @@ fn write_ui_font_family(font: SharedString, cx: &mut App) {
"Welcome Font Changed",
type = "ui font",
old = theme_settings.ui_font_family,
new = font.clone()
new = font
);
theme_settings.ui_font_family = Some(FontFamilyName(font.into()));
});
@ -134,7 +134,7 @@ fn write_buffer_font_family(font_family: SharedString, cx: &mut App) {
"Welcome Font Changed",
type = "editor font",
old = theme_settings.buffer_font_family,
new = font_family.clone()
new = font_family
);
theme_settings.buffer_font_family = Some(FontFamilyName(font_family.into()));
@ -314,7 +314,7 @@ fn render_font_customization_section(
.child(
PopoverMenu::new("ui-font-picker")
.menu({
let ui_font_picker = ui_font_picker.clone();
let ui_font_picker = ui_font_picker;
move |_window, _cx| Some(ui_font_picker.clone())
})
.trigger(
@ -378,7 +378,7 @@ fn render_font_customization_section(
.child(
PopoverMenu::new("buffer-font-picker")
.menu({
let buffer_font_picker = buffer_font_picker.clone();
let buffer_font_picker = buffer_font_picker;
move |_window, _cx| Some(buffer_font_picker.clone())
})
.trigger(

View file

@ -206,7 +206,7 @@ impl ThemePreviewTile {
sidebar_width,
skeleton_height.clone(),
))
.child(Self::render_pane(seed, theme, skeleton_height.clone()))
.child(Self::render_pane(seed, theme, skeleton_height))
}
fn render_borderless(seed: f32, theme: Arc<Theme>) -> impl IntoElement {
@ -260,7 +260,7 @@ impl ThemePreviewTile {
.overflow_hidden()
.child(div().size_full().child(Self::render_editor(
seed,
theme.clone(),
theme,
sidebar_width,
Self::SKELETON_HEIGHT_DEFAULT,
)))
@ -329,9 +329,9 @@ impl Component for ThemePreviewTile {
let themes_to_preview = vec![
one_dark.clone().ok(),
one_light.clone().ok(),
gruvbox_dark.clone().ok(),
gruvbox_light.clone().ok(),
one_light.ok(),
gruvbox_dark.ok(),
gruvbox_light.ok(),
]
.into_iter()
.flatten()
@ -348,7 +348,7 @@ impl Component for ThemePreviewTile {
div()
.w(px(240.))
.h(px(180.))
.child(ThemePreviewTile::new(one_dark.clone(), 0.42))
.child(ThemePreviewTile::new(one_dark, 0.42))
.into_any_element(),
)])]
} else {