Skip to content

Commit 4cd8e64

Browse files
refactor: use more idiomatic Rust in From traits
1 parent cd61512 commit 4cd8e64

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ pub struct TxIn {
178178
}
179179

180180
impl From<BitcoinTxIn> for TxIn {
181-
fn from(value: BitcoinTxIn) -> Self {
182-
Self {
183-
previous_output: value.previous_output,
184-
script_sig: Arc::new(value.script_sig.into()),
185-
sequence: value.sequence.0,
186-
witness: value.witness.to_vec(),
181+
fn from(tx_in: BitcoinTxIn) -> Self {
182+
TxIn {
183+
previous_output: tx_in.previous_output,
184+
script_sig: Arc::new(tx_in.script_sig.into()),
185+
sequence: tx_in.sequence.0,
186+
witness: tx_in.witness.to_vec(),
187187
}
188188
}
189189
}
@@ -200,12 +200,12 @@ impl From<&BitcoinTxIn> for TxIn {
200200
}
201201

202202
impl From<TxIn> for BitcoinTxIn {
203-
fn from(value: TxIn) -> Self {
204-
Self {
205-
previous_output: value.previous_output,
206-
script_sig: value.script_sig.0.clone(),
207-
sequence: Sequence(value.sequence),
208-
witness: value.witness.into(),
203+
fn from(tx_in: TxIn) -> Self {
204+
BitcoinTxIn {
205+
previous_output: tx_in.previous_output,
206+
script_sig: tx_in.script_sig.0.clone(),
207+
sequence: Sequence(tx_in.sequence),
208+
witness: tx_in.witness.into(),
209209
}
210210
}
211211
}

0 commit comments

Comments
 (0)