Skip to content

Commit

Permalink
use core::error::Error
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Sep 6, 2024
1 parent f1faa47 commit f97ce47
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 22 deletions.
6 changes: 2 additions & 4 deletions crates/interpreter/src/interpreter/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions crates/interpreter/src/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
3 changes: 1 addition & 2 deletions crates/optimism/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<InvalidTransaction> for OptimismInvalidTransaction {
fn from(value: InvalidTransaction) -> Self {
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ impl From<Eip7702DecodeError> 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 {
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/bytecode/eof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/eip7702/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 2 additions & 4 deletions crates/primitives/src/precompile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -196,8 +195,7 @@ impl From<PrecompileError> 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 {
Expand Down
6 changes: 2 additions & 4 deletions crates/primitives/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ impl From<InvalidAuthorization> 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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f97ce47

Please sign in to comment.