]> Untitled Git - bdk/commitdiff
[blockchain] Fix clippy warnings
authorAlekos Filini <alekos.filini@gmail.com>
Tue, 1 Dec 2020 13:36:15 +0000 (14:36 +0100)
committerAlekos Filini <alekos.filini@gmail.com>
Tue, 1 Dec 2020 13:41:59 +0000 (14:41 +0100)
src/blockchain/utils.rs

index 8fb0f342a2e50940ba2652cba347d71782def771..3d7a3d98cbb9aad501a20fcd980938fcd0c5ad85 100644 (file)
@@ -310,9 +310,7 @@ fn save_transaction_details_and_utxos<D: BatchDatabase>(
     updates: &mut dyn BatchOperations,
     utxo_deps: &HashMap<OutPoint, OutPoint>,
 ) -> Result<(), Error> {
-    let tx = db
-        .get_raw_tx(txid)?
-        .ok_or_else(|| Error::TransactionNotFound)?;
+    let tx = db.get_raw_tx(txid)?.ok_or(Error::TransactionNotFound)?;
 
     let mut incoming: u64 = 0;
     let mut outgoing: u64 = 0;
@@ -338,7 +336,7 @@ fn save_transaction_details_and_utxos<D: BatchDatabase>(
             // The input is not ours, but we still need to count it for the fees
             let tx = db
                 .get_raw_tx(&input.previous_output.txid)?
-                .ok_or_else(|| Error::TransactionNotFound)?;
+                .ok_or(Error::TransactionNotFound)?;
             inputs_sum += tx.output[input.previous_output.vout as usize].value;
         }
 
@@ -392,7 +390,7 @@ fn utxos_deps<D: BatchDatabase>(
     for utxo in utxos {
         let from_tx = tx_raw_in_db
             .get(&utxo.outpoint.txid)
-            .ok_or_else(|| Error::TransactionNotFound)?;
+            .ok_or(Error::TransactionNotFound)?;
         for input in from_tx.input.iter() {
             utxos_deps.insert(input.previous_output, utxo.outpoint);
         }