From 165f910f560a51545f93b3eab496cc92ad210aa8 Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Fri, 18 Oct 2024 10:45:34 -0400 Subject: [PATCH] refactor: use more idiomatic Rust in From traits --- src/lib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5769264..7d2ae3e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -178,12 +178,12 @@ pub struct TxIn { } impl From for TxIn { - fn from(value: BitcoinTxIn) -> Self { - Self { - previous_output: value.previous_output, - script_sig: Arc::new(value.script_sig.into()), - sequence: value.sequence.0, - witness: value.witness.to_vec(), + fn from(tx_in: BitcoinTxIn) -> Self { + TxIn { + previous_output: tx_in.previous_output, + script_sig: Arc::new(tx_in.script_sig.into()), + sequence: tx_in.sequence.0, + witness: tx_in.witness.to_vec(), } } } @@ -200,12 +200,12 @@ impl From<&BitcoinTxIn> for TxIn { } impl From for BitcoinTxIn { - fn from(value: TxIn) -> Self { - Self { - previous_output: value.previous_output, - script_sig: value.script_sig.0.clone(), - sequence: Sequence(value.sequence), - witness: value.witness.into(), + fn from(tx_in: TxIn) -> Self { + BitcoinTxIn { + previous_output: tx_in.previous_output, + script_sig: tx_in.script_sig.0.clone(), + sequence: Sequence(tx_in.sequence), + witness: tx_in.witness.into(), } } }