diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2024-04-18 17:12:11 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2024-05-07 09:10:33 +0200 |
commit | 331b931c8f96e2c4f29d6646a03cba1ae636819c (patch) | |
tree | d9d448ec3b90f413a3cabe72eaa1a65fbdec3833 | |
parent | 8dae8f22382f92a1aafb01b7be26af6b81bea859 (diff) |
openpgp: Simplify splitting the signatures.
-rw-r--r-- | openpgp/src/cert/parser/mod.rs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs index 6100b92c..4728a553 100644 --- a/openpgp/src/cert/parser/mod.rs +++ b/openpgp/src/cert/parser/mod.rs @@ -924,10 +924,9 @@ impl<'a> CertParser<'a> { /// vectors. fn split_sigs<C>(primary: &KeyHandle, b: &mut ComponentBundle<C>) { - let mut self_signatures = Vec::with_capacity(0); - let mut certifications = Vec::with_capacity(0); - let mut self_revs = Vec::with_capacity(0); - let mut other_revs = Vec::with_capacity(0); + debug_assert!(b.self_signatures.is_empty()); + debug_assert!(b.self_revocations.is_empty()); + debug_assert!(b.other_revocations.is_empty()); for sig in mem::replace(&mut b.certifications, Vec::with_capacity(0)) { let typ = sig.typ(); @@ -943,21 +942,16 @@ fn split_sigs<C>(primary: &KeyHandle, b: &mut ComponentBundle<C>) || typ == CertificationRevocation { if is_selfsig { - self_revs.push(sig); + b.self_revocations.push(sig); } else { - other_revs.push(sig); + b.other_revocations.push(sig); } } else if is_selfsig { - self_signatures.push(sig); + b.self_signatures.push(sig); } else { - certifications.push(sig); + b.certifications.push(sig); } } - - b.self_signatures = self_signatures; - b.certifications = certifications; - b.self_revocations = self_revs; - b.other_revocations = other_revs; } impl<'a> Iterator for CertParser<'a> { |