aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/hash.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-01-03 08:31:57 -0800
committerSteven Fackler <[email protected]>2015-01-03 08:31:57 -0800
commit2f24d8e771cfc140e53e6afe58994aafd455b701 (patch)
tree2d44ec4c5167f99abc05e8d0df9f3528ad872f72 /src/crypto/hash.rs
parentMerge pull request #136 from vhbit/up-master (diff)
downloadrust-openssl-2f24d8e771cfc140e53e6afe58994aafd455b701.tar.xz
rust-openssl-2f24d8e771cfc140e53e6afe58994aafd455b701.zip
Fix deprecation warnings
Diffstat (limited to 'src/crypto/hash.rs')
-rw-r--r--src/crypto/hash.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crypto/hash.rs b/src/crypto/hash.rs
index a9711e92..1f8a3936 100644
--- a/src/crypto/hash.rs
+++ b/src/crypto/hash.rs
@@ -1,6 +1,7 @@
use libc::c_uint;
use std::ptr;
use std::io;
+use std::iter::repeat;
use ffi;
@@ -101,7 +102,7 @@ impl Hasher {
* initialization and its context for reuse
*/
pub fn finalize_reuse(self) -> (Vec<u8>, HasherContext) {
- let mut res = Vec::from_elem(self.len, 0u8);
+ let mut res = repeat(0u8).take(self.len).collect::<Vec<_>>();
unsafe {
ffi::EVP_DigestFinal_ex(self.ctx.ptr, res.as_mut_ptr(), ptr::null_mut())
};