diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-10-05 14:36:26 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-10-05 17:40:29 +0200 |
commit | 3a5f081d18ab8a52c398727f807b2454377ba69c (patch) | |
tree | d73b6618f117d15beef0fcdd50ff7acab4123f98 /openpgp | |
parent | f6e2e1d3be653f7fc201122faa89e05177f9b35c (diff) |
openpgp: Avoid allocating backing arrays.
- Three of the five vectors will never contain any values.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/cert/parser/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs index 0e705e2d..8bd91317 100644 --- a/openpgp/src/cert/parser/mod.rs +++ b/openpgp/src/cert/parser/mod.rs @@ -878,12 +878,12 @@ impl<'a> CertParser<'a> { pub(crate) fn split_sigs<C>(primary: &KeyHandle, primary_keyid: &KeyHandle, b: &mut ComponentBundle<C>) { - let mut self_signatures = vec![]; - let mut certifications = vec![]; - let mut self_revs = vec![]; - let mut other_revs = vec![]; + 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); - for sig in mem::replace(&mut b.certifications, vec![]) { + for sig in mem::replace(&mut b.certifications, Vec::with_capacity(0)) { let typ = sig.typ(); let issuers = |