Skip to content

Commit 27899da

Browse files
committed
Merge #284: Revert "clippy!: Box large enum variants"
14d6a62 Revert "clippy!: `Box` large enum variants" (Steve Myers) Pull request description: Reverts #277 Per discussion on team chat yesterday we need to revert this since it's a breaking change and wasn't meant to be merged until the 3.0 milestone. ValuedMammal will have to re-submit a replacement PR. ACKs for top commit: ValuedMammal: ACK 14d6a62 Tree-SHA512: 110446e6e7af41f8303d540755202b5df2c67340fd3f608756acb8335a378cf76e1e3a1c79f06c6170ed1ac0ca25413d8575c2be034882632d86a015297be285
2 parents 4c2e000 + 14d6a62 commit 27899da

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

clippy.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
msrv = "1.63.0"
1+
# TODO fix, see: https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
2+
enum-variant-size-threshold = 1032
3+
# TODO fix, see: https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
4+
large-error-threshold = 993

wallet/src/wallet/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ pub enum LoadMismatch {
227227
/// Keychain identifying the descriptor.
228228
keychain: KeychainKind,
229229
/// The loaded descriptor.
230-
loaded: Option<Box<ExtendedDescriptor>>,
230+
loaded: Option<ExtendedDescriptor>,
231231
/// The expected descriptor.
232-
expected: Option<Box<ExtendedDescriptor>>,
232+
expected: Option<ExtendedDescriptor>,
233233
},
234234
}
235235

@@ -565,8 +565,8 @@ impl Wallet {
565565
if descriptor.descriptor_id() != exp_desc.descriptor_id() {
566566
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
567567
keychain: KeychainKind::External,
568-
loaded: Some(Box::new(descriptor)),
569-
expected: Some(Box::new(exp_desc)),
568+
loaded: Some(descriptor),
569+
expected: Some(exp_desc),
570570
}));
571571
}
572572
if params.extract_keys {
@@ -575,7 +575,7 @@ impl Wallet {
575575
} else {
576576
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
577577
keychain: KeychainKind::External,
578-
loaded: Some(Box::new(descriptor)),
578+
loaded: Some(descriptor),
579579
expected: None,
580580
}));
581581
}
@@ -595,7 +595,7 @@ impl Wallet {
595595
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
596596
keychain: KeychainKind::Internal,
597597
loaded: None,
598-
expected: Some(Box::new(exp_desc)),
598+
expected: Some(exp_desc),
599599
}));
600600
}
601601
}
@@ -609,7 +609,7 @@ impl Wallet {
609609
None => {
610610
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
611611
keychain: KeychainKind::Internal,
612-
loaded: Some(Box::new(desc)),
612+
loaded: Some(desc),
613613
expected: None,
614614
}))
615615
}
@@ -621,8 +621,8 @@ impl Wallet {
621621
if desc.descriptor_id() != exp_desc.descriptor_id() {
622622
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
623623
keychain: KeychainKind::Internal,
624-
loaded: Some(Box::new(desc)),
625-
expected: Some(Box::new(exp_desc)),
624+
loaded: Some(desc),
625+
expected: Some(exp_desc),
626626
}));
627627
}
628628
if params.extract_keys {

wallet/src/wallet/persisted.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ impl<P: WalletPersister> PersistedWallet<P> {
150150
) -> Result<Self, CreateWithPersistError<P::Error>> {
151151
let existing = P::initialize(persister).map_err(CreateWithPersistError::Persist)?;
152152
if !existing.is_empty() {
153-
return Err(CreateWithPersistError::DataAlreadyExists(Box::new(
154-
existing,
155-
)));
153+
return Err(CreateWithPersistError::DataAlreadyExists(existing));
156154
}
157155
let mut inner =
158156
Wallet::create_with_params(params).map_err(CreateWithPersistError::Descriptor)?;
@@ -209,9 +207,7 @@ impl<P: AsyncWalletPersister> PersistedWallet<P> {
209207
.await
210208
.map_err(CreateWithPersistError::Persist)?;
211209
if !existing.is_empty() {
212-
return Err(CreateWithPersistError::DataAlreadyExists(Box::new(
213-
existing,
214-
)));
210+
return Err(CreateWithPersistError::DataAlreadyExists(existing));
215211
}
216212
let mut inner =
217213
Wallet::create_with_params(params).map_err(CreateWithPersistError::Descriptor)?;
@@ -296,7 +292,6 @@ impl WalletPersister for bdk_chain::rusqlite::Connection {
296292

297293
/// Error for [`bdk_file_store`]'s implementation of [`WalletPersister`].
298294
#[cfg(feature = "file_store")]
299-
#[allow(clippy::large_enum_variant)] // Can be fixed in `bdk_file_store` by boxing the dump.
300295
#[derive(Debug)]
301296
pub enum FileStoreError {
302297
/// Error when loading from the store.
@@ -362,7 +357,7 @@ pub enum CreateWithPersistError<E> {
362357
/// Error from persistence.
363358
Persist(E),
364359
/// Persister already has wallet data.
365-
DataAlreadyExists(Box<ChangeSet>),
360+
DataAlreadyExists(ChangeSet),
366361
/// Occurs when the loaded changeset cannot construct [`Wallet`].
367362
Descriptor(DescriptorError),
368363
}

wallet/tests/persisted_wallet.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ fn single_descriptor_wallet_persist_and_recover() {
346346
// should error on wrong internal params
347347
let desc = get_test_wpkh();
348348
let (exp_desc, _) = <Descriptor<DescriptorPublicKey>>::parse_descriptor(secp, desc).unwrap();
349-
let exp_desc = Box::new(exp_desc);
350349
let err = Wallet::load()
351350
.descriptor(KeychainKind::Internal, Some(desc))
352351
.extract_keys()

0 commit comments

Comments
 (0)