Skip to content

Commit

Permalink
fix: cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed May 25, 2024
1 parent 31671c0 commit 6410d39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion fedimint-clientd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async fn main() -> Result<()> {
.merge(metrics.routes())
.layer(metrics);

let listener = tokio::net::TcpListener::bind(format!("{}", &cli.addr))
let listener = tokio::net::TcpListener::bind(cli.addr.clone())
.await
.map_err(|e| anyhow::anyhow!("Failed to bind to address, should be a valid address and port like 127.0.0.1:3333: {e}"))?;
info!("fedimint-clientd Listening on {}", &cli.addr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn _invoice(
req.amount_msat,
Bolt11InvoiceDescription::Direct(&Description::new(req.description)?),
req.expiry_time,
req.external_pubkey.clone(),
req.external_pubkey,
req.tweak,
(),
Some(gateway),
Expand Down
21 changes: 9 additions & 12 deletions multimint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ impl MultiMint {
Self::load_clients(&mut clients.clone(), &db, &client_builder).await?;

Ok(Self {
db: db,
client_builder: client_builder,
db,
client_builder,
clients,
})
}
Expand Down Expand Up @@ -196,7 +196,7 @@ impl MultiMint {
) -> Result<FederationId> {
let manual_secret: Option<[u8; 64]> = match manual_secret {
Some(manual_secret) => {
let bytes = hex::decode(&manual_secret)?;
let bytes = hex::decode(manual_secret)?;
Some(
bytes
.try_into()
Expand Down Expand Up @@ -274,7 +274,7 @@ impl MultiMint {
.collect::<Vec<_>>();
let federation_id = keys
.into_iter()
.find(|id| id.to_prefix() == federation_id_prefix.clone());
.find(|id| id.to_prefix() == *federation_id_prefix);

match federation_id {
Some(federation_id) => self.get(&federation_id).await,
Expand All @@ -284,10 +284,7 @@ impl MultiMint {

/// Update a client by its federation id.
pub async fn update(&self, federation_id: &FederationId, new_client: ClientHandleArc) {
self.clients
.lock()
.await
.insert(federation_id.clone(), new_client);
self.clients.lock().await.insert(*federation_id, new_client);
}

/// Remove a client by its federation id.
Expand Down Expand Up @@ -317,7 +314,7 @@ impl MultiMint {

for (federation_id, client) in clients.iter() {
let client_config = client.get_config_json();
configs_map.insert(federation_id.clone(), client_config);
configs_map.insert(*federation_id, client_config);
}

Ok(configs_map)
Expand All @@ -330,7 +327,7 @@ impl MultiMint {

for (federation_id, client) in clients.iter() {
let balance = client.get_balance().await;
balances.insert(federation_id.clone(), balance);
balances.insert(*federation_id, balance);
}

Ok(balances)
Expand All @@ -355,15 +352,15 @@ impl MultiMint {
.await;

let info = InfoResponse {
federation_id: federation_id.clone(),
federation_id: *federation_id,
network: wallet_client.get_network().to_string(),
meta: client.get_config().global.meta.clone(),
total_amount_msat: summary.total_amount(),
total_num_notes: summary.count_items(),
denominations_msat: summary,
};

info_map.insert(federation_id.clone(), info);
info_map.insert(*federation_id, info);
}

Ok(info_map)
Expand Down

0 comments on commit 6410d39

Please sign in to comment.