about summary refs log tree commit diff
path: root/src/libstd/ffi/c_str.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/ffi/c_str.rs')
-rw-r--r--src/libstd/ffi/c_str.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index 3e503074ab4..f99d3c14ed8 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -468,6 +468,7 @@ mod tests {
     use super::*;
     use libc;
     use borrow::Cow::{Borrowed, Owned};
+    use hash::{SipHasher, Hash, Hasher};
 
     #[test]
     fn c_to_rust() {
@@ -545,15 +546,16 @@ mod tests {
 
     #[test]
     fn equal_hash() {
-        use hash;
-
         let data = b"123\xE2\xFA\xA6\0";
         let ptr = data.as_ptr() as *const libc::c_char;
         let cstr: &'static CStr = unsafe { CStr::from_ptr(ptr) };
 
-        let cstr_hash = hash::hash::<_, hash::SipHasher>(&cstr);
-        let cstring_hash =
-            hash::hash::<_, hash::SipHasher>(&CString::new(&data[..data.len() - 1]).unwrap());
+        let mut s = SipHasher::new_with_keys(0, 0);
+        cstr.hash(&mut s);
+        let cstr_hash = s.finish();
+        let mut s = SipHasher::new_with_keys(0, 0);
+        CString::new(&data[..data.len() - 1]).unwrap().hash(&mut s);
+        let cstring_hash = s.finish();
 
         assert_eq!(cstr_hash, cstring_hash);
     }