Skip to content

Commit

Permalink
chore: shift std::error impls to core
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jan 4, 2025
1 parent 40e3378 commit 8fcd91a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
21 changes: 10 additions & 11 deletions crates/eips/src/eip1898.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,12 @@ pub enum ParseBlockNumberError {
}

/// Error variants when parsing a [BlockNumberOrTag]
#[cfg(feature = "std")]
impl std::error::Error for ParseBlockNumberError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
impl core::error::Error for ParseBlockNumberError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::ParseIntErr(err) => std::error::Error::source(err),
Self::ParseErr(err) => std::error::Error::source(err),
Self::MissingPrefix(err) => std::error::Error::source(err),
Self::ParseIntErr(err) => core::error::Error::source(err),
Self::MissingPrefix(err) => core::error::Error::source(err),
Self::ParseErr(_) => None,
}
}
}
Expand Down Expand Up @@ -600,12 +599,12 @@ impl fmt::Display for ParseBlockIdError {
}

#[cfg(feature = "std")]
impl std::error::Error for ParseBlockIdError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
impl core::error::Error for ParseBlockIdError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::ParseIntError(err) => std::error::Error::source(err),
Self::FromHexError(err) => std::error::Error::source(err),
Self::ParseError(err) => std::error::Error::source(err),
Self::ParseIntError(err) => core::error::Error::source(err),
Self::FromHexError(err) => core::error::Error::source(err),
Self::ParseError(err) => core::error::Error::source(err),
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions crates/eips/src/eip2718.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ impl From<Eip2718Error> for alloy_rlp::Error {
}
}

#[cfg(feature = "std")]
impl std::error::Error for Eip2718Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
impl core::error::Error for Eip2718Error {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::RlpError(err) => Some(err),
Self::UnexpectedType(_) => None,
Expand Down
5 changes: 2 additions & 3 deletions crates/rpc-types-engine/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ pub enum PayloadError {
Decode(alloy_rlp::Error),
}

#[cfg(feature = "std")]
impl std::error::Error for PayloadError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
impl core::error::Error for PayloadError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::Decode(err) => Some(err),
_ => None,
Expand Down

0 comments on commit 8fcd91a

Please sign in to comment.