summaryrefslogtreecommitdiffstats
path: root/openpgp/src/serialize/stream.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-10-23 17:17:02 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-10-23 17:17:02 +0200
commitdcc70d1cbe8e89f735d10c9cd66e7cfe17c73a9c (patch)
treeeaa1c8171976b0a14c95eff9a88ce5f493807662 /openpgp/src/serialize/stream.rs
parente6e2658e8159449b0a6752d83db6f490942b8bf8 (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/serialize/stream.rs')
-rw-r--r--openpgp/src/serialize/stream.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs
index aa8b30a5..420738a3 100644
--- a/openpgp/src/serialize/stream.rs
+++ b/openpgp/src/serialize/stream.rs
@@ -1678,9 +1678,7 @@ mod test {
};
let mut buffer = Vec::new();
- while buffer.len() < read_len {
- buffer.push(0);
- }
+ buffer.resize(read_len, 0);
let mut decrypted_content = Vec::new();
loop {