Skip to content

Commit

Permalink
Run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino committed Oct 7, 2024
1 parent 921be06 commit 9f26671
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
8 changes: 6 additions & 2 deletions src-tauri/src/address_index/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ where
}

fn skip_invalid<'de, D>(deserializer: D) -> Result<Vec<Vin>, D::Error>
where D: Deserializer<'de>
where
D: Deserializer<'de>,
{
let vins: Vec<Vin> = Vec::deserialize(deserializer)?;
Ok(vins.into_iter().filter_map(|e|if e.txid.is_empty() {None}else { Some(e) }).collect())
Ok(vins
.into_iter()
.filter_map(|e| if e.txid.is_empty() { None } else { Some(e) })
.collect())
}

#[cfg(test)]
Expand Down
23 changes: 11 additions & 12 deletions src-tauri/src/explorer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ where
pivx_rpc: rpc,
}
}

}

static EXPLORER: OnceCell<DefaultExplorer> = OnceCell::const_new();
Expand All @@ -66,17 +65,17 @@ async fn get_explorer() -> &'static DefaultExplorer {
pivx_rpc.clone(),
);
std::mem::forget(pivx);

let explorer = Explorer::new(address_index, pivx_rpc);
// Cloning is very cheap, it's just a Pathbuf and some Arcs
let explorer_clone = explorer.clone();
tokio::spawn(async move {
if let Err(err) = explorer_clone.sync().await {
eprintln!("Warning: Syncing failed with error {}", err);
}
});

explorer
// Cloning is very cheap, it's just a Pathbuf and some Arcs
let explorer_clone = explorer.clone();
tokio::spawn(async move {
if let Err(err) = explorer_clone.sync().await {
eprintln!("Warning: Syncing failed with error {}", err);
}
});

explorer
})
.await
}
Expand Down Expand Up @@ -171,6 +170,6 @@ where
}

pub async fn sync(&self) -> crate::error::Result<()> {
self.address_index.clone().sync().await
self.address_index.clone().sync().await
}
}
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn main() {
explorer_get_transaction,
explorer_send_transaction,
explorer_get_tx_from_vin,
explorer_sync,
explorer_sync,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down

0 comments on commit 9f26671

Please sign in to comment.