diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2020-05-12 17:07:44 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2020-06-08 14:36:13 +0200 |
commit | c51d96b98f1ed92fe7bc6d964abb0d2a8616bae1 (patch) | |
tree | 9fb9ea374e712da619c0985b9ddc0f4377b0b749 /openpgp/src/crypto/s2k.rs | |
parent | 5be97d9c6ee82f068a5b38aa455f31497d3f20bf (diff) |
openpgp: Introduce feature flag for quickcheck.
- Make quickcheck dependency optional.
- Make quickcheck a dev-dependency for tests.
- Fix doctests for
- cert::ValidCert::user_attributes,
- cert::builder::CertBuilder::add_user_attribute,
- cert::revoke::UserAttributeRevocationBuilder
- cert::revoke::UserAttributeRevocationBuilder::build.
Doctests do not use cfg(test), so we cannot use quickcheck in there.
Diffstat (limited to 'openpgp/src/crypto/s2k.rs')
-rw-r--r-- | openpgp/src/crypto/s2k.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs index 8dff4693..d5553ce4 100644 --- a/openpgp/src/crypto/s2k.rs +++ b/openpgp/src/crypto/s2k.rs @@ -14,7 +14,9 @@ use crate::crypto::SessionKey; use std::fmt; +#[cfg(any(test, feature = "quickcheck"))] use quickcheck::{Arbitrary, Gen}; +#[cfg(any(test, feature = "quickcheck"))] use rand::Rng; /// String-to-Key (S2K) specifiers. @@ -262,6 +264,7 @@ impl fmt::Display for S2K { } } +#[cfg(any(test, feature = "quickcheck"))] impl Arbitrary for S2K { fn arbitrary<G: Gen>(g: &mut G) -> Self { match g.gen_range(0, 5) { |