Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove a bunch of un-needed clones #78

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ pub fn run_core() -> Subscription<Message> {
// 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");

Expand Down
4 changes: 2 additions & 2 deletions src/db_models/fedimint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
19 changes: 8 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -186,34 +186,31 @@ 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");
}
}

async fn async_receive(ui_handle: Option<Arc<bridge::UIHandle>>, 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");
}
}

async fn async_receive_onchain(ui_handle: Option<Arc<bridge::UIHandle>>, 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");
}
}

async fn async_unlock(ui_handle: Option<Arc<bridge::UIHandle>>, 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");
}
Expand All @@ -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");
}
Expand All @@ -237,15 +234,15 @@ 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");
}
}

async fn async_get_seed_words(ui_handle: Option<Arc<bridge::UIHandle>>, 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");
}
Expand Down