diff options
author | Neal H. Walfield <neal@pep.foundation> | 2019-10-23 17:17:02 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2019-10-23 17:17:02 +0200 |
commit | dcc70d1cbe8e89f735d10c9cd66e7cfe17c73a9c (patch) | |
tree | eaa1c8171976b0a14c95eff9a88ce5f493807662 /openpgp/src/crypto/aead.rs | |
parent | e6e2658e8159449b0a6752d83db6f490942b8bf8 (diff) |
openpgp: Use Vec::resize instead of a loop.
- Instead of pushing an element at a time, use Vec::resize to grow
the vector to the desired size.
Diffstat (limited to 'openpgp/src/crypto/aead.rs')
-rw-r--r-- | openpgp/src/crypto/aead.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/openpgp/src/crypto/aead.rs b/openpgp/src/crypto/aead.rs index 0a34cbae..0f3e5330 100644 --- a/openpgp/src/crypto/aead.rs +++ b/openpgp/src/crypto/aead.rs @@ -304,9 +304,7 @@ impl<'a> Decryptor<'a> { // chunk, then we have to double buffer. let double_buffer = to_decrypt > plaintext.len() - pos; let buffer = if double_buffer { - while self.buffer.len() < to_decrypt { - self.buffer.push(0u8); - } + self.buffer.resize(to_decrypt, 0); &mut self.buffer[..] } else { &mut plaintext[pos..pos + to_decrypt] |