From ec5fa397c21f1ffccc64112b319e3917dcf45cb1 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Fri, 31 May 2024 15:50:24 -0500 Subject: [PATCH] Remove a bunch of un-needed clones --- src/core.rs | 2 +- src/db_models/fedimint.rs | 4 ++-- src/main.rs | 19 ++++++++----------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/core.rs b/src/core.rs index ba5b80d..a9fccab 100644 --- a/src/core.rs +++ b/src/core.rs @@ -366,7 +366,7 @@ pub fn run_core() -> Subscription { // Setup UI Handle let (ui_handle, mut core_handle) = bridge::create_handles(); let arc_ui_handle = Arc::new(ui_handle); - tx.send(Message::UIHandlerLoaded(arc_ui_handle.clone())) + tx.send(Message::UIHandlerLoaded(arc_ui_handle)) .await .expect("should send"); diff --git a/src/db_models/fedimint.rs b/src/db_models/fedimint.rs index af9102f..cc7d641 100644 --- a/src/db_models/fedimint.rs +++ b/src/db_models/fedimint.rs @@ -30,8 +30,8 @@ impl Fedimint { pub fn update(&self, conn: &mut SqliteConnection) -> anyhow::Result<()> { let _ = diesel::update(fedimint::table) - .filter(fedimint::id.eq(self.id.clone())) - .set(fedimint::value.eq(self.value.clone())) + .filter(fedimint::id.eq(&self.id)) + .set(fedimint::value.eq(&self.value)) .execute(conn)?; Ok(()) diff --git a/src/main.rs b/src/main.rs index 1cc3f1d..42225f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -172,7 +172,7 @@ impl HarborWallet { invoice: Bolt11Invoice, ) { if let Some(ui_handle) = ui_handle { - ui_handle.clone().send_lightning(id, invoice).await; + ui_handle.send_lightning(id, invoice).await; } else { panic!("UI handle is None"); } @@ -186,10 +186,7 @@ impl HarborWallet { ) { println!("Got to async_send"); if let Some(ui_handle) = ui_handle { - ui_handle - .clone() - .send_onchain(id, address, amount_sats) - .await; + ui_handle.send_onchain(id, address, amount_sats).await; } else { panic!("UI handle is None"); } @@ -197,7 +194,7 @@ impl HarborWallet { async fn async_receive(ui_handle: Option>, id: Uuid, amount: u64) { if let Some(ui_handle) = ui_handle { - ui_handle.clone().receive(id, amount).await; + ui_handle.receive(id, amount).await; } else { panic!("UI handle is None"); } @@ -205,7 +202,7 @@ impl HarborWallet { async fn async_receive_onchain(ui_handle: Option>, id: Uuid) { if let Some(ui_handle) = ui_handle { - ui_handle.clone().receive_onchain(id).await; + ui_handle.receive_onchain(id).await; } else { panic!("UI handle is None"); } @@ -213,7 +210,7 @@ impl HarborWallet { async fn async_unlock(ui_handle: Option>, id: Uuid, password: String) { if let Some(ui_handle) = ui_handle { - ui_handle.clone().unlock(id, password).await; + ui_handle.unlock(id, password).await; } else { panic!("UI handle is None"); } @@ -225,7 +222,7 @@ impl HarborWallet { invite: InviteCode, ) { if let Some(ui_handle) = ui_handle { - ui_handle.clone().add_federation(id, invite).await; + ui_handle.add_federation(id, invite).await; } else { panic!("UI handle is None"); } @@ -237,7 +234,7 @@ impl HarborWallet { invite: InviteCode, ) { if let Some(ui_handle) = ui_handle { - ui_handle.clone().peek_federation(id, invite).await; + ui_handle.peek_federation(id, invite).await; } else { panic!("UI handle is None"); } @@ -245,7 +242,7 @@ impl HarborWallet { async fn async_get_seed_words(ui_handle: Option>, id: Uuid) { if let Some(ui_handle) = ui_handle { - ui_handle.clone().get_seed_words(id).await; + ui_handle.get_seed_words(id).await; } else { panic!("UI handle is None"); }