Skip to content

Commit

Permalink
fix: clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
binarybaron committed Nov 20, 2024
1 parent 32a1ae9 commit dbdee03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions swap/src/cli/tor.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use std::path::PathBuf;
use std::path::Path;
use std::sync::Arc;

use arti_client::{config::TorClientConfigBuilder, Error, TorClient};
use tor_rtcompat::tokio::TokioRustlsRuntime;

pub async fn init_tor_client(
data_dir: &PathBuf,
) -> Result<Arc<TorClient<TokioRustlsRuntime>>, Error> {
pub async fn init_tor_client(data_dir: &Path) -> Result<Arc<TorClient<TokioRustlsRuntime>>, Error> {
// We store the Tor state in the data directory
let data_dir = data_dir.join("tor");
let state_dir = data_dir.join("state");
Expand All @@ -16,7 +14,7 @@ pub async fn init_tor_client(
// and what directories to use for storing persistent state.
let config = TorClientConfigBuilder::from_directories(state_dir, cache_dir)
.build()
.unwrap();
.expect("We initialized the Tor client all required attributes");

// Start the Arti client, and let it bootstrap a connection to the Tor network.
// (This takes a while to gather the necessary directory information.
Expand Down
7 changes: 4 additions & 3 deletions swap/src/monero/wallet_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::cli::api::tauri_bindings::{

// See: https://www.moneroworld.com/#nodes, https://monero.fail
// We don't need any testnet nodes because we don't support testnet at all
const MONERO_DAEMONS: Lazy<[MoneroDaemon; 16]> = Lazy::new(|| {
static MONERO_DAEMONS: Lazy<[MoneroDaemon; 16]> = Lazy::new(|| {
[
MoneroDaemon::new("xmr-node.cakewallet.com", 18081, Network::Mainnet),
MoneroDaemon::new("nodex.monerujo.io", 18081, Network::Mainnet),
Expand Down Expand Up @@ -169,8 +169,9 @@ async fn choose_monero_daemon(network: Network) -> Result<MoneroDaemon, Error> {
.build()?;

// We only want to check for daemons that match the specified network
let daemons = &*MONERO_DAEMONS;
let network_matching_daemons = daemons.iter().filter(|daemon| daemon.network == network);
let network_matching_daemons = MONERO_DAEMONS
.iter()
.filter(|daemon| daemon.network == network);

for daemon in network_matching_daemons {
match daemon.is_available(&client).await {
Expand Down

0 comments on commit dbdee03

Please sign in to comment.