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

View file

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