diff --git a/crates/eips/src/eip1898.rs b/crates/eips/src/eip1898.rs index 6b6205f7645..11dda34eeba 100644 --- a/crates/eips/src/eip1898.rs +++ b/crates/eips/src/eip1898.rs @@ -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) => Some(err), + Self::MissingPrefix(err) => Some(err), + Self::ParseErr(_) => None, } } } @@ -599,13 +598,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) => Some(err), + Self::FromHexError(err) => Some(err), + Self::ParseError(_) => None, } } } @@ -826,7 +824,6 @@ impl FromStr for HashOrNumber { type Err = ParseBlockHashOrNumberError; fn from_str(s: &str) -> Result { - #[cfg(not(feature = "std"))] use alloc::string::ToString; match u64::from_str(s) { diff --git a/crates/eips/src/eip2718.rs b/crates/eips/src/eip2718.rs index 4333e01ac07..2f5e19a3d6c 100644 --- a/crates/eips/src/eip2718.rs +++ b/crates/eips/src/eip2718.rs @@ -49,15 +49,7 @@ impl From for alloy_rlp::Error { } } -#[cfg(feature = "std")] -impl std::error::Error for Eip2718Error { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - Self::RlpError(err) => Some(err), - Self::UnexpectedType(_) => None, - } - } -} +impl core::error::Error for Eip2718Error {} /// Decoding trait for [EIP-2718] envelopes. These envelopes wrap a transaction /// or a receipt with a type flag. diff --git a/crates/rpc-types-engine/src/error.rs b/crates/rpc-types-engine/src/error.rs index b114be7bcf0..1737769b19d 100644 --- a/crates/rpc-types-engine/src/error.rs +++ b/crates/rpc-types-engine/src/error.rs @@ -69,15 +69,7 @@ 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)> { - match self { - Self::Decode(err) => Some(err), - _ => None, - } - } -} +impl core::error::Error for PayloadError {} impl From for PayloadError { fn from(value: alloy_rlp::Error) -> Self {