From 613f1cf2d5b611534e62291bbf77cc30189851ec Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 28 Jul 2022 11:57:14 +1000 Subject: [PATCH] Implement std::error::Error::source for bip152 During the recent merge of bip152 we ended up with a Rust 1.29 version of the `error::Error`. Implement `source` inline with our new MSRV. --- src/util/bip152.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/util/bip152.rs b/src/util/bip152.rs index 101f2e8e..1dbdd583 100644 --- a/src/util/bip152.rs +++ b/src/util/bip152.rs @@ -38,7 +38,16 @@ impl fmt::Display for Error { } #[cfg(feature = "std")] -impl error::Error for Error {} +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + use self::Error::*; + + match *self { + UnknownVersion | InvalidPrefill => None, + } + } +} /// A [PrefilledTransaction] structure is used in [HeaderAndShortIds] to /// provide a list of a few transactions explicitly.