8000 Impl std error using macro by Kixunil · Pull Request #1136 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Impl std error using macro #1136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/network/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,7 @@ impl fmt::Display for CommandStringError {
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for CommandStringError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
None
}
}
crate::error::impl_std_error!(CommandStringError);

/// A Network message
#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
17 changes: 3 additions & 14 deletions src/util/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{io, Script, Transaction, TxIn, TxOut, Sequence, Sighash};
use crate::blockdata::transaction::EncodeSigningDataResult;
use crate::blockdata::witness::Witness;
use crate::consensus::{encode, Encodable};
use crate::error::impl_std_error;
use crate::util::endian;
use crate::hashes::{sha256, sha256d, Hash};
use crate::internal_macros::serde_string_impl;
Expand Down Expand Up @@ -488,13 +489,7 @@ impl fmt::Display for NonStandardSighashType {
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for NonStandardSighashType {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
None
}
}
impl_std_error!(NonStandardSighashType);

/// Error returned for failure during parsing one of the sighash types.
///
Expand All @@ -511,13 +506,7 @@ impl fmt::Display for SighashTypeParseError {
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for SighashTypeParseError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
None
}
}
impl_std_error!(SighashTypeParseError);

impl<R: Deref<Target = Transaction>> SighashCache<R> {
/// Constructs a new `SighashCache` from an unsigned transaction.
Expand Down
8 changes: 1 addition & 7 deletions src/util/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,7 @@ impl core::fmt::Display for ParseLengthError {
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for ParseLengthError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
None
}
}
crate::error::impl_std_error!(ParseLengthError);

impl Uint256 {
/// Decay to a uint128
Expand Down
0