summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/generate-encrypt-decrypt.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-05-13 16:48:49 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-05-13 16:49:49 +0200
commitfb8c180a057a5c912a88a8d44f53cd53efb1d2d8 (patch)
treea918f25e3790ad50cedd1146c9ee8aa34a3606c8 /openpgp/examples/generate-encrypt-decrypt.rs
parent41f8260e0c8cd04a0d2e5ddce27a48522048385c (diff)
openpgp: Avoid constructing vectors of recipients.
- Every iterator implements IntoIterator. Simplify accordingly.
Diffstat (limited to 'openpgp/examples/generate-encrypt-decrypt.rs')
-rw-r--r--openpgp/examples/generate-encrypt-decrypt.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/openpgp/examples/generate-encrypt-decrypt.rs b/openpgp/examples/generate-encrypt-decrypt.rs
index dba5ebf8..e19c98b0 100644
--- a/openpgp/examples/generate-encrypt-decrypt.rs
+++ b/openpgp/examples/generate-encrypt-decrypt.rs
@@ -47,12 +47,10 @@ fn encrypt(p: &dyn Policy, sink: &mut dyn Write, plaintext: &str,
recipient: &openpgp::Cert)
-> openpgp::Result<()>
{
- // Build a vector of recipients to hand to Encryptor.
let recipients =
recipient.keys().with_policy(p, None).alive().revoked(false)
.for_transport_encryption()
- .map(|ka| ka.key())
- .collect::<Vec<_>>();
+ .map(|ka| ka.key());
// Start streaming an OpenPGP message.
let message = Message::new(sink);