From f97ce4735685799f76d84c00dd19278cef899393 Mon Sep 17 00:00:00 2001 From: rakita Date: Fri, 6 Sep 2024 03:27:54 +0200 Subject: [PATCH] use core::error::Error --- crates/interpreter/src/interpreter/analysis.rs | 6 ++---- crates/interpreter/src/opcode.rs | 4 ++-- crates/optimism/src/result.rs | 3 +-- crates/primitives/src/bytecode.rs | 3 +-- crates/primitives/src/bytecode/eof.rs | 3 +-- crates/primitives/src/eip7702/bytecode.rs | 3 +-- crates/primitives/src/precompile.rs | 6 ++---- crates/primitives/src/result.rs | 6 ++---- 8 files changed, 12 insertions(+), 22 deletions(-) diff --git a/crates/interpreter/src/interpreter/analysis.rs b/crates/interpreter/src/interpreter/analysis.rs index 0f3651a7bd..c2ea93506c 100644 --- a/crates/interpreter/src/interpreter/analysis.rs +++ b/crates/interpreter/src/interpreter/analysis.rs @@ -219,8 +219,7 @@ impl fmt::Display for EofError { } } -#[cfg(feature = "std")] -impl std::error::Error for EofError {} +impl core::error::Error for EofError {} #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum EofValidationError { @@ -442,8 +441,7 @@ impl fmt::Display for EofValidationError { } } -#[cfg(feature = "std")] -impl std::error::Error for EofValidationError {} +impl core::error::Error for EofValidationError {} /// Validates that: /// * All instructions are valid. diff --git a/crates/interpreter/src/opcode.rs b/crates/interpreter/src/opcode.rs index 7de81588e4..587810f5d6 100644 --- a/crates/interpreter/src/opcode.rs +++ b/crates/interpreter/src/opcode.rs @@ -24,8 +24,8 @@ impl fmt::Display for OpCodeError { } } -#[cfg(all(feature = "std", feature = "parse"))] -impl std::error::Error for OpCodeError {} +#[cfg(feature = "parse")] +impl core::error::Error for OpCodeError {} /// An EVM opcode. /// diff --git a/crates/optimism/src/result.rs b/crates/optimism/src/result.rs index 2749f91581..63093fc9f5 100644 --- a/crates/optimism/src/result.rs +++ b/crates/optimism/src/result.rs @@ -58,8 +58,7 @@ impl Display for OptimismInvalidTransaction { } } -#[cfg(feature = "std")] -impl std::error::Error for OptimismInvalidTransaction {} +impl core::error::Error for OptimismInvalidTransaction {} impl From for OptimismInvalidTransaction { fn from(value: InvalidTransaction) -> Self { diff --git a/crates/primitives/src/bytecode.rs b/crates/primitives/src/bytecode.rs index bae4161806..d3fbbd2868 100644 --- a/crates/primitives/src/bytecode.rs +++ b/crates/primitives/src/bytecode.rs @@ -235,8 +235,7 @@ impl From for BytecodeDecodeError { } } -#[cfg(feature = "std")] -impl std::error::Error for BytecodeDecodeError {} +impl core::error::Error for BytecodeDecodeError {} impl fmt::Display for BytecodeDecodeError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/primitives/src/bytecode/eof.rs b/crates/primitives/src/bytecode/eof.rs index 8ed12abb86..d25f61f6d9 100644 --- a/crates/primitives/src/bytecode/eof.rs +++ b/crates/primitives/src/bytecode/eof.rs @@ -182,8 +182,7 @@ impl fmt::Display for EofDecodeError { } } -#[cfg(feature = "std")] -impl std::error::Error for EofDecodeError {} +impl core::error::Error for EofDecodeError {} #[cfg(test)] mod test { diff --git a/crates/primitives/src/eip7702/bytecode.rs b/crates/primitives/src/eip7702/bytecode.rs index 268f2c4aa6..89a8082389 100644 --- a/crates/primitives/src/eip7702/bytecode.rs +++ b/crates/primitives/src/eip7702/bytecode.rs @@ -93,8 +93,7 @@ impl fmt::Display for Eip7702DecodeError { } } -#[cfg(feature = "std")] -impl std::error::Error for Eip7702DecodeError {} +impl core::error::Error for Eip7702DecodeError {} #[cfg(test)] mod tests { diff --git a/crates/primitives/src/precompile.rs b/crates/primitives/src/precompile.rs index 890e1b537e..25938bb580 100644 --- a/crates/primitives/src/precompile.rs +++ b/crates/primitives/src/precompile.rs @@ -140,8 +140,7 @@ pub enum PrecompileErrors { Fatal { msg: String }, } -#[cfg(feature = "std")] -impl std::error::Error for PrecompileErrors {} +impl core::error::Error for PrecompileErrors {} impl fmt::Display for PrecompileErrors { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -196,8 +195,7 @@ impl From for PrecompileErrors { } } -#[cfg(feature = "std")] -impl std::error::Error for PrecompileError {} +impl core::error::Error for PrecompileError {} impl fmt::Display for PrecompileError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index 8596991292..7dee33d49d 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -311,8 +311,7 @@ impl From for InvalidTransaction { } } -#[cfg(feature = "std")] -impl std::error::Error for InvalidTransaction {} +impl core::error::Error for InvalidTransaction {} impl fmt::Display for InvalidTransaction { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -388,8 +387,7 @@ pub enum InvalidHeader { ExcessBlobGasNotSet, } -#[cfg(feature = "std")] -impl std::error::Error for InvalidHeader {} +impl core::error::Error for InvalidHeader {} impl fmt::Display for InvalidHeader { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {