Skip to content

Commit 627d963

Browse files
committed
psbt: remove derives from UtxoUpdateError and OutputUpdateError
Going forward, we should only derive Debug and whichever of Clone, PartialEq and Eq are possible. PartialEq is very useful for doing assertions, and Clone is often useful because it allows Results to be cloned. But the other traits are uncommon to implement on error types, have an unclear meaning, and limit our ability to compose types without breaking changes. Also adds a bunch of Eq bounds to error types that implement PartialEq. There is almost never a reason to implement PartialEq but not Eq. In the next commit I'm gonna replace ConversionError, an old error which derives all these things, with the new NonDefiniteKeyError, which will prevent these derives from working on UtxoUpdateError.
1 parent c169af0 commit 627d963

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/descriptor/key.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl DescriptorMultiXKey<bip32::Xpriv> {
328328
}
329329

330330
/// Kinds of malformed key data
331-
#[derive(Debug, PartialEq, Clone)]
331+
#[derive(Debug, PartialEq, Eq, Clone)]
332332
#[non_exhaustive]
333333
#[allow(missing_docs)]
334334
pub enum NonDefiniteKeyError {
@@ -353,7 +353,7 @@ impl fmt::Display for NonDefiniteKeyError {
353353
impl error::Error for NonDefiniteKeyError {}
354354

355355
/// Kinds of malformed key data
356-
#[derive(Debug, PartialEq, Clone)]
356+
#[derive(Debug, PartialEq, Eq, Clone)]
357357
#[non_exhaustive]
358358
#[allow(missing_docs)]
359359
pub enum MalformedKeyDataKind {
@@ -397,7 +397,7 @@ impl fmt::Display for MalformedKeyDataKind {
397397
}
398398

399399
/// Descriptor Key parsing errors
400-
#[derive(Debug, PartialEq, Clone)]
400+
#[derive(Debug, PartialEq, Eq, Clone)]
401401
#[non_exhaustive]
402402
pub enum DescriptorKeyParseError {
403403
/// Error while parsing a BIP32 extended private key

src/psbt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ fn update_item_with_descriptor_helper<F: PsbtFields>(
11751175
}
11761176

11771177
/// Return error type for [`PsbtExt::update_input_with_descriptor`]
1178-
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
1178+
#[derive(Debug, PartialEq, Eq, Clone)]
11791179
pub enum UtxoUpdateError {
11801180
/// Index out of bounds
11811181
IndexOutOfBounds(usize, usize),
@@ -1224,7 +1224,7 @@ impl error::Error for UtxoUpdateError {
12241224
}
12251225

12261226
/// Return error type for [`PsbtExt::update_output_with_descriptor`]
1227-
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
1227+
#[derive(Debug, PartialEq, Eq, Clone)]
12281228
pub enum OutputUpdateError {
12291229
/// Index out of bounds
12301230
IndexOutOfBounds(usize, usize),

0 commit comments

Comments
 (0)