diff options
Diffstat (limited to 'openpgp/src/packet/signature/mod.rs')
-rw-r--r-- | openpgp/src/packet/signature/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs index d0829a5d..74be7900 100644 --- a/openpgp/src/packet/signature/mod.rs +++ b/openpgp/src/packet/signature/mod.rs @@ -2,6 +2,8 @@ use std::fmt; use std::ops::{Deref, DerefMut}; + +#[cfg(any(test, feature = "quickcheck"))] use quickcheck::{Arbitrary, Gen}; use crate::Error; @@ -28,6 +30,7 @@ use crate::packet::signature::subpacket::{ SubpacketAreas, }; +#[cfg(any(test, feature = "quickcheck"))] /// Like quickcheck::Arbitrary, but bounded. trait ArbitraryBounded { /// Generates an arbitrary value, but only recurses if `depth > @@ -35,9 +38,11 @@ trait ArbitraryBounded { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self; } +#[cfg(any(test, feature = "quickcheck"))] /// Default depth when implementing Arbitrary using ArbitraryBounded. const DEFAULT_ARBITRARY_DEPTH: usize = 2; +#[cfg(any(test, feature = "quickcheck"))] macro_rules! impl_arbitrary_with_bound { ($typ:path) => { impl Arbitrary for $typ { @@ -101,6 +106,7 @@ pub struct SignatureBuilder { subpackets: SubpacketAreas, } +#[cfg(any(test, feature = "quickcheck"))] impl ArbitraryBounded for SignatureBuilder { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { SignatureBuilder { @@ -115,6 +121,7 @@ impl ArbitraryBounded for SignatureBuilder { } } +#[cfg(any(test, feature = "quickcheck"))] impl_arbitrary_with_bound!(SignatureBuilder); impl Deref for SignatureBuilder { @@ -1212,14 +1219,17 @@ impl From<Signature4> for super::Signature { } } +#[cfg(any(test, feature = "quickcheck"))] impl ArbitraryBounded for super::Signature { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { Signature4::arbitrary_bounded(g, depth).into() } } +#[cfg(any(test, feature = "quickcheck"))] impl_arbitrary_with_bound!(super::Signature); +#[cfg(any(test, feature = "quickcheck"))] impl ArbitraryBounded for Signature4 { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { use mpi::MPI; @@ -1262,6 +1272,7 @@ impl ArbitraryBounded for Signature4 { } } +#[cfg(any(test, feature = "quickcheck"))] impl_arbitrary_with_bound!(Signature4); #[cfg(test)] |