diff options
Diffstat (limited to 'openpgp/src')
25 files changed, 95 insertions, 95 deletions
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs index 0cd071d7..68a1a8bc 100644 --- a/openpgp/src/armor.rs +++ b/openpgp/src/armor.rs @@ -35,7 +35,7 @@ use std::cmp; use std::str; use std::borrow::Cow; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::vec_truncate; @@ -70,7 +70,7 @@ pub enum Kind { File, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Kind { fn arbitrary<G: Gen>(g: &mut G) -> Self { use self::Kind::*; diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs index 2cddbb05..5088e9f3 100644 --- a/openpgp/src/crypto/mpi.rs +++ b/openpgp/src/crypto/mpi.rs @@ -18,9 +18,9 @@ use std::fmt; use std::cmp::Ordering; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use rand::Rng; use crate::types::{ @@ -245,7 +245,7 @@ impl Hash for MPI { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for MPI { fn arbitrary<G: Gen>(g: &mut G) -> Self { loop { @@ -555,7 +555,7 @@ impl Hash for PublicKey { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for PublicKey { fn arbitrary<G: Gen>(g: &mut G) -> Self { use self::PublicKey::*; @@ -822,7 +822,7 @@ impl Hash for SecretKeyMaterial { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for SecretKeyMaterial { fn arbitrary<G: Gen>(g: &mut G) -> Self { match g.gen_range(0, 6) { @@ -929,7 +929,7 @@ impl Hash for Ciphertext { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Ciphertext { fn arbitrary<G: Gen>(g: &mut G) -> Self { match g.gen_range(0, 3) { @@ -1023,7 +1023,7 @@ impl Hash for Signature { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Signature { fn arbitrary<G: Gen>(g: &mut G) -> Self { match g.gen_range(0, 4) { diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs index 84b75b02..f403589c 100644 --- a/openpgp/src/crypto/s2k.rs +++ b/openpgp/src/crypto/s2k.rs @@ -14,9 +14,9 @@ use crate::crypto::SessionKey; use std::fmt; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use rand::Rng; /// String-to-Key (S2K) specifiers. @@ -370,7 +370,7 @@ impl fmt::Display for S2K { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for S2K { fn arbitrary<G: Gen>(g: &mut G) -> Self { #[allow(deprecated)] diff --git a/openpgp/src/fingerprint.rs b/openpgp/src/fingerprint.rs index 5cc5907e..07559d7c 100644 --- a/openpgp/src/fingerprint.rs +++ b/openpgp/src/fingerprint.rs @@ -1,6 +1,6 @@ use std::fmt; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; /// A long identifier for certificates and keys. @@ -216,7 +216,7 @@ impl Fingerprint { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Fingerprint { fn arbitrary<G: Gen>(g: &mut G) -> Self { use rand::Rng; diff --git a/openpgp/src/keyid.rs b/openpgp/src/keyid.rs index 1d0410df..e5bd9bcb 100644 --- a/openpgp/src/keyid.rs +++ b/openpgp/src/keyid.rs @@ -1,6 +1,6 @@ use std::fmt; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::Error; @@ -262,7 +262,7 @@ impl KeyID { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for KeyID { fn arbitrary<G: Gen>(g: &mut G) -> Self { KeyID::new(u64::arbitrary(g)) diff --git a/openpgp/src/packet/compressed_data.rs b/openpgp/src/packet/compressed_data.rs index 4f379496..bc673890 100644 --- a/openpgp/src/packet/compressed_data.rs +++ b/openpgp/src/packet/compressed_data.rs @@ -1,6 +1,6 @@ use std::fmt; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::packet; @@ -96,7 +96,7 @@ impl From<CompressedData> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for CompressedData { fn arbitrary<G: Gen>(g: &mut G) -> Self { use rand::Rng; diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs index 462c5396..728075e2 100644 --- a/openpgp/src/packet/key.rs +++ b/openpgp/src/packet/key.rs @@ -91,7 +91,7 @@ use std::cmp::Ordering; use std::convert::TryInto; use std::time; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::Error; @@ -1506,7 +1506,7 @@ impl Encrypted { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl<P, R> Arbitrary for super::Key<P, R> where P: KeyParts, P: Clone, R: KeyRole, R: Clone, @@ -1517,7 +1517,7 @@ impl<P, R> Arbitrary for super::Key<P, R> } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Key4<PublicParts, UnspecifiedRole> { fn arbitrary<G: Gen>(g: &mut G) -> Self { let mpis = mpi::PublicKey::arbitrary(g); @@ -1534,7 +1534,7 @@ impl Arbitrary for Key4<PublicParts, UnspecifiedRole> { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Key4<SecretParts, UnspecifiedRole> { fn arbitrary<G: Gen>(g: &mut G) -> Self { use rand::Rng; diff --git a/openpgp/src/packet/literal.rs b/openpgp/src/packet/literal.rs index 7eb4082b..f9865fbc 100644 --- a/openpgp/src/packet/literal.rs +++ b/openpgp/src/packet/literal.rs @@ -3,7 +3,7 @@ use std::cmp; use std::convert::TryInto; use std::time; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::types::{DataFormat, Timestamp}; @@ -174,7 +174,7 @@ impl From<Literal> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Literal { fn arbitrary<G: Gen>(g: &mut G) -> Self { let mut l = Literal::new(DataFormat::arbitrary(g)); diff --git a/openpgp/src/packet/marker.rs b/openpgp/src/packet/marker.rs index 728f115b..ecd50dbe 100644 --- a/openpgp/src/packet/marker.rs +++ b/openpgp/src/packet/marker.rs @@ -1,4 +1,4 @@ -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::packet; @@ -35,7 +35,7 @@ impl From<Marker> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Marker { fn arbitrary<G: Gen>(_: &mut G) -> Self { Self::default() diff --git a/openpgp/src/packet/mod.rs b/openpgp/src/packet/mod.rs index b0d1dcdb..f18a9d6d 100644 --- a/openpgp/src/packet/mod.rs +++ b/openpgp/src/packet/mod.rs @@ -161,7 +161,7 @@ use std::ops::{Deref, DerefMut}; use std::slice; use std::iter::IntoIterator; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::Error; @@ -439,7 +439,7 @@ impl<'a> DerefMut for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Packet { fn arbitrary<G: Gen>(g: &mut G) -> Self { use rand::Rng; @@ -485,7 +485,7 @@ pub struct Common { dummy: std::marker::PhantomData<()>, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Common { fn arbitrary<G: Gen>(_: &mut G) -> Self { // XXX: Change if this gets interesting fields. diff --git a/openpgp/src/packet/one_pass_sig.rs b/openpgp/src/packet/one_pass_sig.rs index d0524c21..281747e1 100644 --- a/openpgp/src/packet/one_pass_sig.rs +++ b/openpgp/src/packet/one_pass_sig.rs @@ -6,7 +6,7 @@ use std::fmt; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::Error; @@ -168,14 +168,14 @@ impl<'a> std::convert::TryFrom<&'a Signature> for OnePassSig3 { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for super::OnePassSig { fn arbitrary<G: Gen>(g: &mut G) -> Self { OnePassSig3::arbitrary(g).into() } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for OnePassSig3 { fn arbitrary<G: Gen>(g: &mut G) -> Self { let mut ops = OnePassSig3::new(SignatureType::arbitrary(g)); diff --git a/openpgp/src/packet/pkesk.rs b/openpgp/src/packet/pkesk.rs index 8b914194..5ea6ff66 100644 --- a/openpgp/src/packet/pkesk.rs +++ b/openpgp/src/packet/pkesk.rs @@ -5,7 +5,7 @@ //! //! [Section 5.1 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.1 -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::Error; @@ -190,14 +190,14 @@ impl From<PKESK3> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for super::PKESK { fn arbitrary<G: Gen>(g: &mut G) -> Self { PKESK3::arbitrary(g).into() } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for PKESK3 { fn arbitrary<G: Gen>(g: &mut G) -> Self { let (ciphertext, pk_algo) = loop { diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs index ec2cc35d..f7eec3f8 100644 --- a/openpgp/src/packet/signature/mod.rs +++ b/openpgp/src/packet/signature/mod.rs @@ -118,7 +118,7 @@ use std::fmt; use std::ops::{Deref, DerefMut}; use std::time::SystemTime; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::Error; @@ -146,7 +146,7 @@ use crate::packet::signature::subpacket::{ SubpacketTag, }; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] /// Like quickcheck::Arbitrary, but bounded. trait ArbitraryBounded { /// Generates an arbitrary value, but only recurses if `depth > @@ -154,11 +154,11 @@ trait ArbitraryBounded { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self; } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] /// Default depth when implementing Arbitrary using ArbitraryBounded. const DEFAULT_ARBITRARY_DEPTH: usize = 2; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] macro_rules! impl_arbitrary_with_bound { ($typ:path) => { impl Arbitrary for $typ { @@ -220,7 +220,7 @@ pub struct SignatureFields { subpackets: SubpacketAreas, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl ArbitraryBounded for SignatureFields { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { SignatureFields { @@ -235,7 +235,7 @@ impl ArbitraryBounded for SignatureFields { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl_arbitrary_with_bound!(SignatureFields); impl Deref for SignatureFields { @@ -2479,17 +2479,17 @@ impl From<Signature4> for super::Signature { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] 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"))] +#[cfg(test)] impl_arbitrary_with_bound!(super::Signature); -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl ArbitraryBounded for Signature4 { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { use mpi::MPI; @@ -2532,7 +2532,7 @@ impl ArbitraryBounded for Signature4 { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl_arbitrary_with_bound!(Signature4); #[cfg(test)] diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index 5146202e..afab45bd 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -63,9 +63,9 @@ use std::fmt; use std::cmp; use std::time; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use crate::packet::signature::ArbitraryBounded; use crate::{ @@ -408,7 +408,7 @@ impl From<SubpacketTag> for u8 { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for SubpacketTag { fn arbitrary<G: Gen>(g: &mut G) -> Self { u8::arbitrary(g).into() @@ -504,7 +504,7 @@ pub struct SubpacketArea { parsed: Mutex<RefCell<Option<HashMap<SubpacketTag, usize>>>>, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl ArbitraryBounded for SubpacketArea { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { use rand::Rng; @@ -518,7 +518,7 @@ impl ArbitraryBounded for SubpacketArea { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl_arbitrary_with_bound!(SubpacketArea); impl Default for SubpacketArea { @@ -976,7 +976,7 @@ pub struct NotationData { value: Vec<u8>, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for NotationData { fn arbitrary<G: Gen>(g: &mut G) -> Self { NotationData { @@ -1021,7 +1021,7 @@ impl NotationData { #[derive(Clone, PartialEq, Eq, Hash)] pub struct NotationDataFlags(crate::types::Bitfield); -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for NotationDataFlags { fn arbitrary<G: Gen>(g: &mut G) -> Self { NotationDataFlags(vec![u8::arbitrary(g), u8::arbitrary(g), @@ -1419,7 +1419,7 @@ pub enum SubpacketValue { #[doc(hidden)] __Nonexhaustive, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl ArbitraryBounded for SubpacketValue { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { use rand::Rng; @@ -1470,7 +1470,7 @@ impl ArbitraryBounded for SubpacketValue { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl_arbitrary_with_bound!(SubpacketValue); impl SubpacketValue { @@ -1575,7 +1575,7 @@ pub struct Subpacket { value: SubpacketValue, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl ArbitraryBounded for Subpacket { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { use rand::Rng; @@ -1620,7 +1620,7 @@ impl ArbitraryBounded for Subpacket { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl_arbitrary_with_bound!(Subpacket); impl fmt::Debug for Subpacket { @@ -1756,7 +1756,7 @@ pub struct SubpacketAreas { unhashed_area: SubpacketArea, } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl ArbitraryBounded for SubpacketAreas { fn arbitrary_bounded<G: Gen>(g: &mut G, depth: usize) -> Self { SubpacketAreas::new(ArbitraryBounded::arbitrary_bounded(g, depth), @@ -1764,7 +1764,7 @@ impl ArbitraryBounded for SubpacketAreas { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl_arbitrary_with_bound!(SubpacketAreas); impl SubpacketAreas { diff --git a/openpgp/src/packet/skesk.rs b/openpgp/src/packet/skesk.rs index d5ea7d91..be63e968 100644 --- a/openpgp/src/packet/skesk.rs +++ b/openpgp/src/packet/skesk.rs @@ -8,7 +8,7 @@ use std::ops::{Deref, DerefMut}; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::Result; @@ -39,7 +39,7 @@ impl SKESK { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for SKESK { fn arbitrary<G: Gen>(g: &mut G) -> Self { if bool::arbitrary(g) { @@ -299,7 +299,7 @@ impl From<SKESK4> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for SKESK4 { fn arbitrary<G: Gen>(g: &mut G) -> Self { SKESK4::new(SymmetricAlgorithm::arbitrary(g), @@ -578,7 +578,7 @@ impl From<SKESK5> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for SKESK5 { fn arbitrary<G: Gen>(g: &mut G) -> Self { let algo = AEADAlgorithm::EAX; // The only one we dig. diff --git a/openpgp/src/packet/tag.rs b/openpgp/src/packet/tag.rs index c7c8ddcf..7ea8c2c0 100644 --- a/openpgp/src/packet/tag.rs +++ b/openpgp/src/packet/tag.rs @@ -2,7 +2,7 @@ use std::fmt; use std::cmp::Ordering; use std::hash::{Hash, Hasher}; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::packet::Packet; @@ -216,7 +216,7 @@ impl fmt::Display for Tag { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Tag { fn arbitrary<G: Gen>(g: &mut G) -> Self { u8::arbitrary(g).into() diff --git a/openpgp/src/packet/trust.rs b/openpgp/src/packet/trust.rs index af876131..08ab6fe8 100644 --- a/openpgp/src/packet/trust.rs +++ b/openpgp/src/packet/trust.rs @@ -1,6 +1,6 @@ use std::fmt; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; use crate::packet; @@ -60,7 +60,7 @@ impl From<Trust> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Trust { fn arbitrary<G: Gen>(g: &mut G) -> Self { Vec::<u8>::arbitrary(g).into() diff --git a/openpgp/src/packet/user_attribute.rs b/openpgp/src/packet/user_attribute.rs index 03703c8c..246c1be6 100644 --- a/openpgp/src/packet/user_attribute.rs +++ b/openpgp/src/packet/user_attribute.rs @@ -6,9 +6,9 @@ use std::fmt; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use quickcheck::{Arbitrary, Gen}; -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] use rand::Rng; use buffered_reader::BufferedReader; @@ -103,7 +103,7 @@ impl From<UserAttribute> for Packet { } } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for UserAttribute { fn arbitrary<G: Gen>(g: &mut G) -> Self { UserAttribute::new( @@ -192,7 +192,7 @@ pub enum Subpacket { Unknown(u8, Box<[u8]>), } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Subpacket { fn arbitrary<G: Gen>(g: &mut G) -> Self { match g.gen_range(0, 3) { @@ -225,7 +225,7 @@ pub enum Image { Unknown(u8, Box<[u8]>), } -#[cfg(any(test, feature = "quickcheck"))] +#[cfg(test)] impl Arbitrary for Image { fn arbitrary<G: Gen>(g: &mut G) -> Self { match g.gen_range(0, 5) { |