Skip to content

Commit

Permalink
Remove optional failure dependency and impl std::error::Error.
Browse files Browse the repository at this point in the history
  • Loading branch information
isislovecruft committed Oct 23, 2019
1 parent 2d2fe9a commit a7f2c6c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ clear_on_drop = "=0.2.3"
subtle = { version = "2", default-features = false }
serde = { version = "1.0", default-features = false, optional = true }
packed_simd = { version = "0.3.0", features = ["into_bits"], optional = true }
failure = { version = "0.1", optional = true }

[build-dependencies]
rand_core = { version = "0.3.0", default-features = false }
Expand All @@ -61,7 +60,6 @@ clear_on_drop = "=0.2.3"
subtle = { version = "2", default-features = false }
serde = { version = "1.0", default-features = false, optional = true }
packed_simd = { version = "0.3.0", features = ["into_bits"], optional = true }
failure = { version = "0.1", optional = true }

[features]
nightly = ["subtle/nightly", "clear_on_drop/nightly"]
Expand Down
3 changes: 0 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ extern crate subtle;
#[cfg(all(feature = "nightly", feature = "packed_simd"))]
extern crate packed_simd;

#[cfg(feature = "failure")]
extern crate failure;

use std::env;
use std::fs::File;
use std::io::Write;
Expand Down
17 changes: 10 additions & 7 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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.
///
Expand All @@ -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)
}
}
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ extern crate packed_simd;
extern crate byteorder;
extern crate clear_on_drop;
pub extern crate digest;
#[cfg(feature = "failure")]
extern crate failure;
extern crate rand_core;
#[cfg(all(test, feature = "stage2_build"))]
extern crate rand_os;
Expand Down

0 comments on commit a7f2c6c

Please sign in to comment.