summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-08-12 18:25:52 +0200
committerNeal H. Walfield <neal@pep.foundation>2020-08-12 18:25:52 +0200
commit0247972157ca8f2ccfbde1ea2b4163959e65ab9d (patch)
tree6c990afb9e890eb13656a1fbf7ace9c7d13cf2db /openpgp/src/parse
parent9f67696414199de4eab30c2c7bc73f2faedfd6f0 (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.rs12
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.