From 5505aa4b3702ea931e0d6eaa36d609c0ff498e0c Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Wed, 14 Aug 2024 15:03:48 +0200 Subject: [PATCH] run clippy --- src/signing.rs | 2 +- src/transactionbuilder.rs | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/signing.rs b/src/signing.rs index 5137517..32a6bd6 100644 --- a/src/signing.rs +++ b/src/signing.rs @@ -525,7 +525,7 @@ mod tests { }; assert!(key .public_key() - .verify(&sig_hash.as_ref(), &signature.signature)); + .verify(sig_hash.as_ref(), &signature.signature)); } } } diff --git a/src/transactionbuilder.rs b/src/transactionbuilder.rs index 1da7a3e..9fcf074 100644 --- a/src/transactionbuilder.rs +++ b/src/transactionbuilder.rs @@ -42,12 +42,16 @@ pub struct ToSign { /// - Add ArbitraryData /// - Add Signature +impl Default for TransactionBuilder { + fn default() -> Self { + Self::new() + } +} + impl TransactionBuilder { /// Creates a new transaction builder pub fn new() -> TransactionBuilder { - TransactionBuilder { - transaction: Default::default(), - } + Default::default() } pub fn add_change_address(self, _address: Address) -> Self { @@ -65,7 +69,7 @@ impl TransactionBuilder { /// condition pub fn add_siacoin_input(mut self, parent_id: SiacoinOutputID, public_key: UnlockKey) -> Self { self.transaction.siacoin_inputs.push(SiacoinInput { - parent_id: parent_id, + parent_id, unlock_conditions: UnlockConditions { public_keys: vec![public_key], timelock: 0, @@ -77,10 +81,9 @@ impl TransactionBuilder { /// Adds a siacoin output with the given value to the transaction pub fn add_siacoin_output(mut self, address: Address, value: Currency) -> Self { - self.transaction.siacoin_outputs.push(SiacoinOutput { - address: address, - value: value, - }); + self.transaction + .siacoin_outputs + .push(SiacoinOutput { address, value }); self }