Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimplekid committed Jan 3, 2025
1 parent 8a1a112 commit 7fbb3ee
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
6 changes: 4 additions & 2 deletions crates/cdk-integration-tests/tests/regtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,13 @@ async fn test_regtest_melt_amountless() -> Result<()> {

lnd_client.pay_invoice(mint_quote.request).await?;

let mint_amount = wallet
let proofs = wallet
.mint(&mint_quote.id, SplitTarget::default(), None)
.await?;

assert!(mint_amount == 100.into());
let amount = proofs.total_amount()?;

assert!(mint_amount == amount);

let invoice = lnd_client.create_invoice(None).await?;

Expand Down
12 changes: 2 additions & 10 deletions crates/cdk-sqlite/src/mint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,7 @@ VALUES (?, ?, ?, ?, ?, ?, ?, ?);
.map(|row| {
PublicKey::from_slice(row.get("y"))
.map_err(Error::from)
.and_then(|y| {
sqlite_row_to_proof(row)
.map_err(Error::from)
.map(|proof| (y, proof))
})
.and_then(|y| sqlite_row_to_proof(row).map(|proof| (y, proof)))
})
.collect::<Result<HashMap<_, _>, _>>()?;

Expand Down Expand Up @@ -1061,11 +1057,7 @@ VALUES (?, ?, ?, ?, ?, ?, ?);
.map(|row| {
PublicKey::from_slice(row.get("y"))
.map_err(Error::from)
.and_then(|y| {
sqlite_row_to_blind_signature(row)
.map_err(Error::from)
.map(|blinded| (y, blinded))
})
.and_then(|y| sqlite_row_to_blind_signature(row).map(|blinded| (y, blinded)))
})
.collect::<Result<HashMap<_, _>, _>>()?;

Expand Down
3 changes: 1 addition & 2 deletions crates/cdk/src/cdk_database/wallet_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ impl WalletDatabase for WalletMemoryDatabase {
) -> Result<(), Self::Err> {
let proofs = self
.get_proofs(Some(old_mint_url), None, None, None)
.await
.map_err(Error::from)?;
.await?;

// Update proofs
{
Expand Down
5 changes: 1 addition & 4 deletions crates/cdk/src/mint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,7 @@ fn create_new_keyset<C: secp256k1::Signing>(
}

fn derivation_path_from_unit(unit: CurrencyUnit, index: u32) -> Option<DerivationPath> {
let unit_index = match unit.derivation_index() {
Some(index) => index,
None => return None,
};
let unit_index = unit.derivation_index()?;

Some(DerivationPath::from(vec![
ChildNumber::from_hardened_idx(0).expect("0 is a valid index"),
Expand Down
1 change: 0 additions & 1 deletion crates/cdk/src/nuts/nut00/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ impl ProofsMethods for Proofs {
self.iter()
.map(|p| p.y())
.collect::<Result<Vec<PublicKey>, _>>()
.map_err(Into::into)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cdk/src/util/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ where
for i in (0..len).step_by(2) {
let high = val(hex[i], i)?;
let low = val(hex[i + 1], i + 1)?;
bytes.push(high << 4 | low);
bytes.push((high << 4) | low);
}

Ok(bytes)
Expand Down

0 comments on commit 7fbb3ee

Please sign in to comment.