Skip to content

Commit

Permalink
sec1: leverage core::error::Error (#1573)
Browse files Browse the repository at this point in the history
Allows use of the `Error` trait without the `std` feature enabled, which
was stabilized in Rust 1.81
  • Loading branch information
tarcieri authored Oct 15, 2024
1 parent e1193ec commit 38e4313
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sec1/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub enum Error {
Version,
}

impl core::error::Error for Error {}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Expand Down Expand Up @@ -77,6 +79,3 @@ impl From<pkcs8::spki::Error> for Error {
Error::Pkcs8(pkcs8::Error::PublicKey(err))
}
}

#[cfg(feature = "std")]
impl std::error::Error for Error {}

0 comments on commit 38e4313

Please sign in to comment.