Remove optional failure dependency and impl std::error::Error.

This commit is contained in:
Isis Lovecruft 2019-10-23 21:32:27 +00:00
parent 1d8b3995c9
commit c21224170a
No known key found for this signature in database
GPG key ID: AB41313533E8E812
2 changed files with 10 additions and 9 deletions

View file

@ -11,12 +11,15 @@
//! //!
//! Currently, these are only used in the implementations of `TryFrom`. //! Currently, these are only used in the implementations of `TryFrom`.
//! //!
//! This module optionally implements support for the types in the `failure` //! If used with `std` support, this public types in this module implement the
//! crate. This can be enabled by building with `--features failure`. //! `std::error::Error` trait.
use core::fmt; use core::fmt;
use core::fmt::Display; use core::fmt::Display;
#[cfg(feature = "std")]
use std::error::Error;
/// Internal errors. Most application-level developers will likely not /// Internal errors. Most application-level developers will likely not
/// need to pay any attention to these. /// need to pay any attention to these.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
@ -41,8 +44,8 @@ impl Display for InternalError {
} }
} }
#[cfg(feature = "failure")] #[cfg(feature = "std")]
impl ::failure::Fail for InternalError {} impl Error for InternalError { }
/// Errors which may occur. /// Errors which may occur.
/// ///
@ -58,9 +61,9 @@ impl Display for CurveError {
} }
} }
#[cfg(feature = "failure")] #[cfg(feature = "std")]
impl ::failure::Fail for CurveError { impl Error for CurveError {
fn cause(&self) -> Option<&dyn (::failure::Fail)> { fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(&self.0) Some(&self.0)
} }
} }

View file

@ -43,8 +43,6 @@ extern crate packed_simd;
extern crate byteorder; extern crate byteorder;
pub extern crate digest; pub extern crate digest;
#[cfg(feature = "failure")]
extern crate failure;
extern crate rand_core; extern crate rand_core;
#[cfg(test)] #[cfg(test)]
extern crate rand_os; extern crate rand_os;