diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-08-12 18:25:52 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-08-12 18:25:52 +0200 |
commit | 0247972157ca8f2ccfbde1ea2b4163959e65ab9d (patch) | |
tree | 6c990afb9e890eb13656a1fbf7ace9c7d13cf2db /openpgp/src/parse | |
parent | 9f67696414199de4eab30c2c7bc73f2faedfd6f0 (diff) |
openpgp: Change SubpacketAreas::intended_recipients to return an iter
- Change `SubpacketAreas::intended_recipients` to return an Iterator
instead of a vector.
Diffstat (limited to 'openpgp/src/parse')
-rw-r--r-- | openpgp/src/parse/stream.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 89943f24..ec6734d5 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -2635,8 +2635,16 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> { error: err, } } else if self.identity.as_ref().map(|identity| { - let ir = sig.intended_recipients(); - ! ir.is_empty() && ! ir.contains(identity) + let (have_one, contains_identity) = + sig.intended_recipients() + .fold((false, false), + |(_, contains_one), ir| { + ( + true, + contains_one || identity == ir + ) + }); + have_one && ! contains_identity }).unwrap_or(false) { // The signature contains intended // recipients, but we are not one. |