summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-12-08 17:40:11 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-12-08 17:40:11 +0100
commit12741c1d0e8b0801f6dfb5963efabef069236ffd (patch)
tree13ba49beae14e31ab0b323d8a52d6464f86b30fd
parent2a82a8d796caa1fec466c7e9d8b7f4868a7665a5 (diff)
openpgp: Tweak the assert_send_and_sync macro.
- Declare trait bounds using a where clause. It looks a bit odd if there is no bound, but not worse than before.
-rw-r--r--openpgp/src/armor.rs2
-rw-r--r--openpgp/src/cert/amalgamation.rs4
-rw-r--r--openpgp/src/cert/amalgamation/iter.rs4
-rw-r--r--openpgp/src/cert/amalgamation/key.rs16
-rw-r--r--openpgp/src/cert/amalgamation/key/iter.rs12
-rw-r--r--openpgp/src/cert/bundle.rs2
-rw-r--r--openpgp/src/crypto/aead.rs2
-rw-r--r--openpgp/src/crypto/symmetric.rs4
-rw-r--r--openpgp/src/fmt.rs2
-rw-r--r--openpgp/src/macros.rs3
-rw-r--r--openpgp/src/packet/key.rs2
-rw-r--r--openpgp/src/packet/mod.rs2
-rw-r--r--openpgp/src/serialize/stream/partial_body.rs2
-rw-r--r--openpgp/src/serialize/stream/writer/mod.rs10
-rw-r--r--openpgp/src/serialize/stream/writer/writer_bzip2.rs2
-rw-r--r--openpgp/src/serialize/stream/writer/writer_deflate.rs4
16 files changed, 36 insertions, 37 deletions
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs
index c3002e7f..686ea939 100644
--- a/openpgp/src/armor.rs
+++ b/openpgp/src/armor.rs
@@ -172,7 +172,7 @@ pub struct Writer<W: Write> {
header: Vec<u8>,
dirty: bool,
}
-assert_send_and_sync!(Writer<W>, W: Write);
+assert_send_and_sync!(Writer<W> where W: Write);
impl<W: Write> Writer<W> {
/// Constructs a new filter for the given type of data.
diff --git a/openpgp/src/cert/amalgamation.rs b/openpgp/src/cert/amalgamation.rs
index 91328528..78efb4cc 100644
--- a/openpgp/src/cert/amalgamation.rs
+++ b/openpgp/src/cert/amalgamation.rs
@@ -647,7 +647,7 @@ pub struct ComponentAmalgamation<'a, C> {
cert: &'a Cert,
bundle: &'a ComponentBundle<C>,
}
-assert_send_and_sync!(ComponentAmalgamation<'_, C>, C);
+assert_send_and_sync!(ComponentAmalgamation<'_, C> where C);
/// A User ID and its associated data.
///
@@ -1078,7 +1078,7 @@ pub struct ValidComponentAmalgamation<'a, C> {
// The binding signature at time `time`. (This is just a cache.)
binding_signature: &'a Signature,
}
-assert_send_and_sync!(ValidComponentAmalgamation<'_, C>, C);
+assert_send_and_sync!(ValidComponentAmalgamation<'_, C> where C);
/// A Valid User ID and its associated data.
///
diff --git a/openpgp/src/cert/amalgamation/iter.rs b/openpgp/src/cert/amalgamation/iter.rs
index 60ac9495..bf940845 100644
--- a/openpgp/src/cert/amalgamation/iter.rs
+++ b/openpgp/src/cert/amalgamation/iter.rs
@@ -90,7 +90,7 @@ pub struct ComponentAmalgamationIter<'a, C> {
cert: &'a Cert,
iter: slice::Iter<'a, ComponentBundle<C>>,
}
-assert_send_and_sync!(ComponentAmalgamationIter<'_, C>, C);
+assert_send_and_sync!(ComponentAmalgamationIter<'_, C> where C);
/// An iterator over `UserIDAmalgamtion`s.
///
@@ -246,7 +246,7 @@ pub struct ValidComponentAmalgamationIter<'a, C> {
// at time `t`.
revoked: Option<bool>,
}
-assert_send_and_sync!(ValidComponentAmalgamationIter<'_, C>, C);
+assert_send_and_sync!(ValidComponentAmalgamationIter<'_, C> where C);
/// An iterator over `ValidUserIDAmalgamtion`s.
///
diff --git a/openpgp/src/cert/amalgamation/key.rs b/openpgp/src/cert/amalgamation/key.rs
index d3dc085f..543da96f 100644
--- a/openpgp/src/cert/amalgamation/key.rs
+++ b/openpgp/src/cert/amalgamation/key.rs
@@ -449,10 +449,10 @@ pub struct KeyAmalgamation<'a, P, R, R2>
ca: ComponentAmalgamation<'a, Key<P, R>>,
primary: R2,
}
-assert_send_and_sync!(KeyAmalgamation<'_, P, R, R2>,
- P: key::KeyParts,
- R: key::KeyRole,
- R2
+assert_send_and_sync!(KeyAmalgamation<'_, P, R, R2>
+ where P: key::KeyParts,
+ R: key::KeyRole,
+ R2,
);
// derive(Clone) doesn't work with generic parameters that don't
@@ -947,10 +947,10 @@ pub struct ValidKeyAmalgamation<'a, P, R, R2>
// The binding signature at time `time`. (This is just a cache.)
binding_signature: &'a Signature,
}
-assert_send_and_sync!(ValidKeyAmalgamation<'_, P, R, R2>,
- P: key::KeyParts,
- R: key::KeyRole,
- R2: Copy
+assert_send_and_sync!(ValidKeyAmalgamation<'_, P, R, R2>
+ where P: key::KeyParts,
+ R: key::KeyRole,
+ R2: Copy,
);
/// A Valid primary Key, and its associated data.
diff --git a/openpgp/src/cert/amalgamation/key/iter.rs b/openpgp/src/cert/amalgamation/key/iter.rs
index 45d3c618..9d4d6ce7 100644
--- a/openpgp/src/cert/amalgamation/key/iter.rs
+++ b/openpgp/src/cert/amalgamation/key/iter.rs
@@ -82,9 +82,9 @@ pub struct KeyAmalgamationIter<'a, P, R>
_p: std::marker::PhantomData<P>,
_r: std::marker::PhantomData<R>,
}
-assert_send_and_sync!(KeyAmalgamationIter<'_, P, R>,
- P: key::KeyParts,
- R: key::KeyRole
+assert_send_and_sync!(KeyAmalgamationIter<'_, P, R>
+ where P: key::KeyParts,
+ R: key::KeyRole,
);
impl<'a, P, R> fmt::Debug for KeyAmalgamationIter<'a, P, R>
@@ -684,9 +684,9 @@ pub struct ValidKeyAmalgamationIter<'a, P, R>
_p: std::marker::PhantomData<P>,
_r: std::marker::PhantomData<R>,
}
-assert_send_and_sync!(ValidKeyAmalgamationIter<'_, P, R>,
- P: key::KeyParts,
- R: key::KeyRole
+assert_send_and_sync!(ValidKeyAmalgamationIter<'_, P, R>
+ where P: key::KeyParts,
+ R: key::KeyRole,
);
impl<'a, P, R> fmt::Debug for ValidKeyAmalgamationIter<'a, P, R>
diff --git a/openpgp/src/cert/bundle.rs b/openpgp/src/cert/bundle.rs
index d755fe80..3693ef1e 100644
--- a/openpgp/src/cert/bundle.rs
+++ b/openpgp/src/cert/bundle.rs
@@ -125,7 +125,7 @@ pub struct ComponentBundle<C> {
// Third-party revocations (e.g., designated revokers).
pub(crate) other_revocations: Vec<Signature>,
}
-assert_send_and_sync!(ComponentBundle<C>, C);
+assert_send_and_sync!(ComponentBundle<C> where C);
/// A key (primary or subkey, public or private) and any associated
/// signatures.
diff --git a/openpgp/src/crypto/aead.rs b/openpgp/src/crypto/aead.rs
index 2544f6c8..fb95b087 100644
--- a/openpgp/src/crypto/aead.rs
+++ b/openpgp/src/crypto/aead.rs
@@ -544,7 +544,7 @@ pub struct Encryptor<W: io::Write> {
// A place to write encrypted data into.
scratch: Vec<u8>,
}
-assert_send_and_sync!(Encryptor<W>, W: io::Write);
+assert_send_and_sync!(Encryptor<W> where W: io::Write);
impl<W: io::Write> Encryptor<W> {
/// Instantiate a new AEAD encryptor.
diff --git a/openpgp/src/crypto/symmetric.rs b/openpgp/src/crypto/symmetric.rs
index 0030b2d4..0a022cc3 100644
--- a/openpgp/src/crypto/symmetric.rs
+++ b/openpgp/src/crypto/symmetric.rs
@@ -51,7 +51,7 @@ pub struct Decryptor<R: io::Read> {
// Up to a block of unread data.
buffer: Vec<u8>,
}
-assert_send_and_sync!(Decryptor<R>, R: io::Read);
+assert_send_and_sync!(Decryptor<R> where R: io::Read);
impl<R: io::Read> Decryptor<R> {
/// Instantiate a new symmetric decryptor. `reader` is the source
@@ -318,7 +318,7 @@ pub struct Encryptor<W: io::Write> {
// A place to write encrypted data into.
scratch: Vec<u8>,
}
-assert_send_and_sync!(Encryptor<W>, W: io::Write);
+assert_send_and_sync!(Encryptor<W> where W: io::Write);
impl<W: io::Write> Encryptor<W> {
/// Instantiate a new symmetric encryptor.
diff --git a/openpgp/src/fmt.rs b/openpgp/src/fmt.rs
index b748f8a2..783c1885 100644
--- a/openpgp/src/fmt.rs
+++ b/openpgp/src/fmt.rs
@@ -61,7 +61,7 @@ pub mod hex {
offset: usize,
}
- assert_send_and_sync!(Dumper<W>, W: io::Write);
+ assert_send_and_sync!(Dumper<W> where W: io::Write);
impl<W: io::Write> Dumper<W> {
/// Creates a new dumper.
diff --git a/openpgp/src/macros.rs b/openpgp/src/macros.rs
index 7810a69b..d350a09b 100644
--- a/openpgp/src/macros.rs
+++ b/openpgp/src/macros.rs
@@ -145,7 +145,7 @@ macro_rules! time_it {
/// ```
///
macro_rules! assert_send_and_sync {
- ( $x:ty, $( $g:ident$( : $b:path )? $(,)?)*) => {
+ ( $x:ty where $( $g:ident$( : $b:path )? $(,)?)*) => {
impl<$( $g ),*> crate::types::Sendable for $x
where $( $g: Send + Sync $(+ $b)? ),*
{}
@@ -158,4 +158,3 @@ macro_rules! assert_send_and_sync {
impl crate::types::Syncable for $x {}
};
}
-
diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs
index 99584a6e..4003e507 100644
--- a/openpgp/src/packet/key.rs
+++ b/openpgp/src/packet/key.rs
@@ -782,7 +782,7 @@ pub struct Key4<P, R>
r: std::marker::PhantomData<R>,
}
-assert_send_and_sync!(Key4<P, R>, P: KeyParts, R: KeyRole);
+assert_send_and_sync!(Key4<P, R> where P: KeyParts, R: KeyRole);
impl<P: KeyParts, R: KeyRole> PartialEq for Key4<P, R> {
fn eq(&self, other: &Key4<P, R>) -> bool {
diff --git a/openpgp/src/packet/mod.rs b/openpgp/src/packet/mod.rs
index 45ef3d3c..d426cc35 100644
--- a/openpgp/src/packet/mod.rs
+++ b/openpgp/src/packet/mod.rs
@@ -1440,7 +1440,7 @@ pub enum Key<P: key::KeyParts, R: key::KeyRole> {
/// A version 4 `Key` packet.
V4(Key4<P, R>),
}
-assert_send_and_sync!(Key<P, R>, P: key::KeyParts, R: key::KeyRole);
+assert_send_and_sync!(Key<P, R> where P: key::KeyParts, R: key::KeyRole);
impl<P: key::KeyParts, R: key::KeyRole> fmt::Display for Key<P, R> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
diff --git a/openpgp/src/serialize/stream/partial_body.rs b/openpgp/src/serialize/stream/partial_body.rs
index cc9afa89..d85ca96e 100644
--- a/openpgp/src/serialize/stream/partial_body.rs
+++ b/openpgp/src/serialize/stream/partial_body.rs
@@ -45,7 +45,7 @@ pub struct PartialBodyFilter<'a, C: 'a> {
// The number of bytes written to this filter.
position: u64,
}
-assert_send_and_sync!(PartialBodyFilter<'_, C>, C);
+assert_send_and_sync!(PartialBodyFilter<'_, C> where C);
const PARTIAL_BODY_FILTER_MAX_CHUNK_SIZE : usize = 1 << 30;
diff --git a/openpgp/src/serialize/stream/writer/mod.rs b/openpgp/src/serialize/stream/writer/mod.rs
index c2f9f518..bc011429 100644
--- a/openpgp/src/serialize/stream/writer/mod.rs
+++ b/openpgp/src/serialize/stream/writer/mod.rs
@@ -189,7 +189,7 @@ pub struct Identity<'a, C> {
inner: Option<BoxStack<'a, C>>,
cookie: C,
}
-assert_send_and_sync!(Identity<'_, C>, C);
+assert_send_and_sync!(Identity<'_, C> where C);
impl<'a> Identity<'a, Cookie> {
/// Makes an identity writer.
@@ -270,7 +270,7 @@ pub struct Generic<W: io::Write + Send + Sync, C> {
cookie: C,
position: u64,
}
-assert_send_and_sync!(Generic<W, C>, W: io::Write, C);
+assert_send_and_sync!(Generic<W, C> where W: io::Write, C);
impl<'a, W: 'a + io::Write + Send + Sync> Generic<W, Cookie> {
/// Wraps an `io::Write`r.
@@ -355,7 +355,7 @@ impl<'a, W: io::Write + Send + Sync, C> Stackable<'a, C> for Generic<W, C> {
pub struct Armorer<'a, C: 'a> {
inner: Generic<armor::Writer<BoxStack<'a, C>>, C>,
}
-assert_send_and_sync!(Armorer<'_, C>, C);
+assert_send_and_sync!(Armorer<'_, C> where C);
impl<'a> Armorer<'a, Cookie> {
/// Makes an armoring writer.
@@ -428,7 +428,7 @@ impl<'a, C: 'a> Stackable<'a, C> for Armorer<'a, C> {
pub struct Encryptor<'a, C: 'a> {
inner: Generic<symmetric::Encryptor<Box<dyn Stackable<'a, C> + Send + Sync + 'a>>, C>,
}
-assert_send_and_sync!(Encryptor<'_, C>, C);
+assert_send_and_sync!(Encryptor<'_, C> where C);
impl<'a> Encryptor<'a, Cookie> {
/// Makes an encrypting writer.
@@ -500,7 +500,7 @@ impl<'a, C: 'a> Stackable<'a, C> for Encryptor<'a, C> {
pub struct AEADEncryptor<'a, C: 'a> {
inner: Generic<aead::Encryptor<BoxStack<'a, C>>, C>,
}
-assert_send_and_sync!(AEADEncryptor<'_, C>, C);
+assert_send_and_sync!(AEADEncryptor<'_, C> where C);
impl<'a> AEADEncryptor<'a, Cookie> {
/// Makes an encrypting writer.
diff --git a/openpgp/src/serialize/stream/writer/writer_bzip2.rs b/openpgp/src/serialize/stream/writer/writer_bzip2.rs
index b38d8f7e..7db8cf89 100644
--- a/openpgp/src/serialize/stream/writer/writer_bzip2.rs
+++ b/openpgp/src/serialize/stream/writer/writer_bzip2.rs
@@ -10,7 +10,7 @@ use super::{Generic, Message, BoxStack, Stackable, Cookie};
pub struct BZ<'a, C: 'a> {
inner: Generic<BzEncoder<BoxStack<'a, C>>, C>,
}
-assert_send_and_sync!(BZ<'_, C>, C);
+assert_send_and_sync!(BZ<'_, C> where C);
impl<'a> BZ<'a, Cookie> {
/// Makes a BZ compressing writer.
diff --git a/openpgp/src/serialize/stream/writer/writer_deflate.rs b/openpgp/src/serialize/stream/writer/writer_deflate.rs
index 27b4bd6b..e254e49c 100644
--- a/openpgp/src/serialize/stream/writer/writer_deflate.rs
+++ b/openpgp/src/serialize/stream/writer/writer_deflate.rs
@@ -10,7 +10,7 @@ use super::{Generic, Message, BoxStack, Stackable, Cookie};
pub struct ZIP<'a, C: 'a> {
inner: Generic<DeflateEncoder<BoxStack<'a, C>>, C>,
}
-assert_send_and_sync!(ZIP<'_, C>, C);
+assert_send_and_sync!(ZIP<'_, C> where C);
impl<'a> ZIP<'a, Cookie> {
/// Makes a ZIP compressing writer.
@@ -79,7 +79,7 @@ impl<'a, C: 'a> Stackable<'a, C> for ZIP<'a, C> {
pub struct ZLIB<'a, C: 'a> {
inner: Generic<ZlibEncoder<BoxStack<'a, C>>, C>,
}
-assert_send_and_sync!(ZLIB<'_, C>, C);
+assert_send_and_sync!(ZLIB<'_, C> where C);
impl<'a> ZLIB<'a, Cookie> {
/// Makes a ZLIB compressing writer.