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

@ -186,7 +186,7 @@ impl ApplicationMenu {
.trigger(
Button::new(
SharedString::from(format!("{}-menu-trigger", menu_name)),
menu_name.clone(),
menu_name,
)
.style(ButtonStyle::Subtle)
.label_size(LabelSize::Small),

View file

@ -155,7 +155,7 @@ impl TitleBar {
.gap_1()
.overflow_x_scroll()
.when_some(
current_user.clone().zip(client.peer_id()).zip(room.clone()),
current_user.zip(client.peer_id()).zip(room),
|this, ((current_user, peer_id), room)| {
let player_colors = cx.theme().players();
let room = room.read(cx);

View file

@ -305,7 +305,6 @@ impl TitleBar {
let nickname = options
.nickname
.clone()
.map(|nick| nick.into())
.unwrap_or_else(|| host.clone());
@ -351,11 +350,7 @@ impl TitleBar {
.indicator_border_color(Some(cx.theme().colors().title_bar_background))
.into_any_element(),
)
.child(
Label::new(nickname.clone())
.size(LabelSize::Small)
.truncate(),
),
.child(Label::new(nickname).size(LabelSize::Small).truncate()),
)
.tooltip(move |window, cx| {
Tooltip::with_meta(