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:
@@ -465,7 +465,7 @@ impl VisualContext for AsyncWindowContext {
|
||||
V: Focusable,
|
||||
{
|
||||
self.window.update(self, |_, window, cx| {
|
||||
view.read(cx).focus_handle(cx).clone().focus(window);
|
||||
view.read(cx).focus_handle(cx).focus(window);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,14 +231,15 @@ impl AnyEntity {
|
||||
Self {
|
||||
entity_id: id,
|
||||
entity_type,
|
||||
entity_map: entity_map.clone(),
|
||||
#[cfg(any(test, feature = "leak-detection"))]
|
||||
handle_id: entity_map
|
||||
.clone()
|
||||
.upgrade()
|
||||
.unwrap()
|
||||
.write()
|
||||
.leak_detector
|
||||
.handle_created(id),
|
||||
entity_map,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ impl TestAppContext {
|
||||
app: App::new_app(platform.clone(), asset_source, http_client),
|
||||
background_executor,
|
||||
foreground_executor,
|
||||
dispatcher: dispatcher.clone(),
|
||||
dispatcher,
|
||||
test_platform: platform,
|
||||
text_system,
|
||||
fn_name,
|
||||
@@ -339,7 +339,7 @@ impl TestAppContext {
|
||||
|
||||
/// Returns all windows open in the test.
|
||||
pub fn windows(&self) -> Vec<AnyWindowHandle> {
|
||||
self.app.borrow().windows().clone()
|
||||
self.app.borrow().windows()
|
||||
}
|
||||
|
||||
/// Run the given task on the main thread.
|
||||
@@ -619,7 +619,7 @@ impl<V> Entity<V> {
|
||||
}
|
||||
}),
|
||||
cx.subscribe(self, {
|
||||
let mut tx = tx.clone();
|
||||
let mut tx = tx;
|
||||
move |_, _: &Evt, _| {
|
||||
tx.blocking_send(()).ok();
|
||||
}
|
||||
@@ -1026,7 +1026,7 @@ impl VisualContext for VisualTestContext {
|
||||
fn focus<V: crate::Focusable>(&mut self, view: &Entity<V>) -> Self::Result<()> {
|
||||
self.window
|
||||
.update(&mut self.cx, |_, window, cx| {
|
||||
view.read(cx).focus_handle(cx).clone().focus(window)
|
||||
view.read(cx).focus_handle(cx).focus(window)
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user