From f6930997d2ab48ea44b282497995aff3e26aa126 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 14 Mar 2017 01:59:08 +0000 Subject: [PATCH] Make #[feature(test)] depend on #[cfg(all(test, feature = "bench"))]. * FIXES Issue #38: https://github.com/isislovecruft/curve25519-dalek/pull/38 --- Cargo.toml | 1 + src/curve.rs | 2 +- src/decaf.rs | 2 +- src/field.rs | 2 +- src/lib.rs | 5 +++-- src/scalar.rs | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 691f464..242b13f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,7 @@ version = "0.4" default = ["std"] std = ["rand"] yolocrypto = [] +bench = [] # The development profile, used for `cargo build`. [profile.dev] diff --git a/src/curve.rs b/src/curve.rs index a9cddf4..93ce31e 100644 --- a/src/curve.rs +++ b/src/curve.rs @@ -1354,7 +1354,7 @@ mod test { // Benchmarks // ------------------------------------------------------------------------ -#[cfg(test)] +#[cfg(all(test, feature = "bench"))] mod bench { use test::Bencher; use constants; diff --git a/src/decaf.rs b/src/decaf.rs index db12cde..775186a 100644 --- a/src/decaf.rs +++ b/src/decaf.rs @@ -358,7 +358,7 @@ mod test { } } -#[cfg(test)] +#[cfg(all(test, feature = "bench"))] mod bench { use rand::OsRng; use test::Bencher; diff --git a/src/field.rs b/src/field.rs index 2cfe7cd..d83db26 100644 --- a/src/field.rs +++ b/src/field.rs @@ -1048,7 +1048,7 @@ mod test { } } -#[cfg(test)] +#[cfg(all(test, feature = "bench"))] mod bench { use test::Bencher; diff --git a/src/lib.rs b/src/lib.rs index 947a531..8903710 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), feature(collections))] #![allow(unused_features)] -#![feature(test)] +#![cfg_attr(feature = "bench", feature(test))] #![deny(missing_docs)] // refuse to compile if documentation is missing //! # curve25519-dalek @@ -33,8 +33,9 @@ //! hatred of the Daleks. Rusty destroys the other Daleks and departs the //! ship, determined to track down and bring an end to the Dalek race. -#[cfg(test)] +#[cfg(all(test, feature = "bench"))] extern crate test; + #[cfg(test)] extern crate sha2; diff --git a/src/scalar.rs b/src/scalar.rs index 71f73cd..f7808e3 100644 --- a/src/scalar.rs +++ b/src/scalar.rs @@ -707,7 +707,7 @@ mod test { } } -#[cfg(test)] +#[cfg(all(test, feature = "bench"))] mod bench { use rand::OsRng; use test::Bencher;