Skip to content

Commit 94237e8

Browse files
committed
fix(clippy): fixing clippy CI build error with Box due to large enum variant
1 parent 1098efc commit 94237e8

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/input.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use alloc::sync::Arc;
22
use alloc::vec::Vec;
33
use core::fmt;
4+
use std::boxed::Box;
45

56
use bitcoin::constants::COINBASE_MATURITY;
67
use bitcoin::transaction::OutputsIndexError;
@@ -34,9 +35,9 @@ impl TxStatus {
3435

3536
#[derive(Debug, Clone)]
3637
enum PlanOrPsbtInput {
37-
Plan(Plan),
38+
Plan(Box<Plan>),
3839
PsbtInput {
39-
psbt_input: psbt::Input,
40+
psbt_input: Box<psbt::Input>,
4041
sequence: Sequence,
4142
absolute_timelock: absolute::LockTime,
4243
satisfaction_weight: usize,
@@ -57,7 +58,7 @@ impl PlanOrPsbtInput {
5758
return Err(FromPsbtInputError::UtxoCheck);
5859
}
5960
Ok(Self::PsbtInput {
60-
psbt_input,
61+
psbt_input: Box::new(psbt_input),
6162
sequence,
6263
absolute_timelock: absolute::LockTime::ZERO,
6364
satisfaction_weight,
@@ -216,7 +217,7 @@ impl Input {
216217
prev_outpoint: OutPoint::new(tx.compute_txid(), output_index as _),
217218
prev_txout: tx.tx_out(output_index).cloned()?,
218219
prev_tx: Some(tx),
219-
plan: PlanOrPsbtInput::Plan(plan),
220+
plan: PlanOrPsbtInput::Plan(Box::new(plan)),
220221
status,
221222
is_coinbase,
222223
})
@@ -234,7 +235,7 @@ impl Input {
234235
prev_outpoint,
235236
prev_txout,
236237
prev_tx: None,
237-
plan: PlanOrPsbtInput::Plan(plan),
238+
plan: PlanOrPsbtInput::Plan(Box::new(plan)),
238239
status,
239240
is_coinbase,
240241
}

src/output.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::boxed::Box;
2+
13
use bitcoin::{Amount, ScriptBuf, TxOut};
24
use miniscript::bitcoin;
35

@@ -9,7 +11,7 @@ pub enum ScriptSource {
911
/// bitcoin script
1012
Script(ScriptBuf),
1113
/// definite descriptor
12-
Descriptor(DefiniteDescriptor),
14+
Descriptor(Box<DefiniteDescriptor>),
1315
}
1416

1517
impl From<ScriptBuf> for ScriptSource {
@@ -32,7 +34,7 @@ impl ScriptSource {
3234

3335
/// From descriptor
3436
pub fn from_descriptor(descriptor: DefiniteDescriptor) -> Self {
35-
Self::Descriptor(descriptor)
37+
Self::Descriptor(Box::new(descriptor))
3638
}
3739

3840
/// To ScriptBuf

src/selection.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use core::fmt::{Debug, Display};
2-
use std::vec::Vec;
2+
use std::{boxed::Box, vec::Vec};
33

44
use bdk_coin_select::FeeRate;
55
use bitcoin::{absolute, transaction, Sequence};
@@ -67,9 +67,9 @@ pub enum CreatePsbtError {
6767
/// Attempted to mix locktime types.
6868
LockTypeMismatch,
6969
/// Missing tx for legacy input.
70-
MissingFullTxForLegacyInput(Input),
70+
MissingFullTxForLegacyInput(Box<Input>),
7171
/// Missing tx for segwit v0 input.
72-
MissingFullTxForSegwitV0Input(Input),
72+
MissingFullTxForSegwitV0Input(Box<Input>),
7373
/// Psbt error.
7474
Psbt(bitcoin::psbt::Error),
7575
/// Update psbt output with descriptor error.
@@ -196,16 +196,16 @@ impl Selection {
196196
psbt_input.non_witness_utxo = plan_input.prev_tx().cloned();
197197
if psbt_input.non_witness_utxo.is_none() {
198198
if witness_version.is_none() {
199-
return Err(CreatePsbtError::MissingFullTxForLegacyInput(
199+
return Err(CreatePsbtError::MissingFullTxForLegacyInput(Box::new(
200200
plan_input.clone(),
201-
));
201+
)));
202202
}
203203
if params.mandate_full_tx_for_segwit_v0
204204
&& witness_version == Some(bitcoin::WitnessVersion::V0)
205205
{
206-
return Err(CreatePsbtError::MissingFullTxForSegwitV0Input(
206+
return Err(CreatePsbtError::MissingFullTxForSegwitV0Input(Box::new(
207207
plan_input.clone(),
208-
));
208+
)));
209209
}
210210
}
211211
continue;

0 commit comments

Comments
 (0)