Skip to content

Commit

Permalink
chore: fix clippy warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Hill <[email protected]>
  • Loading branch information
gregdhill committed Mar 29, 2023
1 parent 4a5e82d commit 34d5e55
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions bitcoin/src/electrs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,7 @@ impl ElectrsClient {
let tx: TransactionValue = self
.get_and_decode(&format!("/tx/{txid}", txid = outpoint.txid))
.await?;
Ok(tx
.vout
.get(outpoint.vout as usize)
.ok_or(Error::NoPrevOut)?
.clone()
.value)
Ok(tx.vout.get(outpoint.vout as usize).ok_or(Error::NoPrevOut)?.value)
}

// TODO: modify upstream to return a human-readable error
Expand Down
4 changes: 2 additions & 2 deletions bitcoin/src/light/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl BitcoinLight {
let electrs_client = ElectrsClient::new(electrs_url, network)?;
let wallet = wallet::Wallet::new(network, electrs_client.clone());
// store the derivation key so it can be used for change
wallet.put_p2wpkh_key(private_key.inner.clone())?;
wallet.put_p2wpkh_key(private_key.inner)?;
Ok(Self {
private_key,
secp_ctx: secp256k1::Secp256k1::new(),
Expand Down Expand Up @@ -269,7 +269,7 @@ impl BitcoinCoreApi for BitcoinLight {
existing_transaction,
return_to_self.unwrap(),
fee_rate,
Some(txid.clone()),
Some(*txid),
)
.await?;
let txid = self.send_transaction(tx).await?;
Expand Down
8 changes: 2 additions & 6 deletions bitcoin/src/light/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fn get_dust_threshold(tx_out: &TxOut, dust_relay_fee_in: &FeeRate) -> u64 {
n_size += 32 + 4 + 1 + 107 + 4;
}

return dust_relay_fee_in.get_fee(n_size);
dust_relay_fee_in.get_fee(n_size)
}

pub type KeyStore = Arc<RwLock<BTreeMap<Address, PrivateKey>>>;
Expand Down Expand Up @@ -255,11 +255,7 @@ pub fn available_coins(
match state.electrs.get_utxos_for_address(&address).await {
Ok(utxos) => {
state.utxos = VecDeque::from(utxos);
if let Some(utxo) = state.utxos.pop_front() {
Some((Ok(utxo), state))
} else {
None
}
state.utxos.pop_front().map(|utxo| (Ok(utxo), state))
}
Err(e) => Some((Err(Error::ElectrsError(e)), state)),
}
Expand Down

0 comments on commit 34d5e55

Please sign in to comment.