about summary refs log tree commit diff
path: root/src/libstd/hash
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-05-16 10:45:16 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-05-22 14:42:01 -0700
commit36195eb91f15975fed7555a3aa52807ecd5698a1 (patch)
treed0e99310be4a24e76b8d6b13f05ec79c1f89b6ba /src/libstd/hash
parente402e75f4eb79af09b9451f0f232f994b3e2c998 (diff)
downloadrust-36195eb91f15975fed7555a3aa52807ecd5698a1.tar.gz
rust-36195eb91f15975fed7555a3aa52807ecd5698a1.zip
libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.
Diffstat (limited to 'src/libstd/hash')
-rw-r--r--src/libstd/hash/mod.rs11
-rw-r--r--src/libstd/hash/sip.rs14
2 files changed, 8 insertions, 17 deletions
diff --git a/src/libstd/hash/mod.rs b/src/libstd/hash/mod.rs
index a510aa90343..1dad1667ebd 100644
--- a/src/libstd/hash/mod.rs
+++ b/src/libstd/hash/mod.rs
@@ -23,7 +23,7 @@
  * #[deriving(Hash)]
  * struct Person {
  *     id: uint,
- *     name: ~str,
+ *     name: StrBuf,
  *     phone: u64,
  * }
  *
@@ -43,7 +43,7 @@
  *
  * struct Person {
  *     id: uint,
- *     name: ~str,
+ *     name: StrBuf,
  *     phone: u64,
  * }
  *
@@ -145,13 +145,6 @@ impl<'a, S: Writer> Hash<S> for &'a str {
     }
 }
 
-impl<S: Writer> Hash<S> for ~str {
-    #[inline]
-    fn hash(&self, state: &mut S) {
-        self.as_slice().hash(state);
-    }
-}
-
 macro_rules! impl_hash_tuple(
     () => (
         impl<S: Writer> Hash<S> for () {
diff --git a/src/libstd/hash/sip.rs b/src/libstd/hash/sip.rs
index 58e0f4c717d..1434e3c7ad7 100644
--- a/src/libstd/hash/sip.rs
+++ b/src/libstd/hash/sip.rs
@@ -458,12 +458,12 @@ mod tests {
         let mut state_inc = SipState::new_with_keys(k0, k1);
         let mut state_full = SipState::new_with_keys(k0, k1);
 
-        fn to_hex_str(r: &[u8, ..8]) -> ~str {
+        fn to_hex_str(r: &[u8, ..8]) -> StrBuf {
             let mut s = StrBuf::new();
             for b in r.iter() {
-                s.push_str((*b as uint).to_str_radix(16u));
+                s.push_str((*b as uint).to_str_radix(16u).as_slice());
             }
-            s.into_owned()
+            s
         }
 
         fn result_bytes(h: u64) -> ~[u8] {
@@ -478,13 +478,13 @@ mod tests {
             ]
         }
 
-        fn result_str(h: u64) -> ~str {
+        fn result_str(h: u64) -> StrBuf {
             let r = result_bytes(h);
             let mut s = StrBuf::new();
             for b in r.iter() {
-                s.push_str((*b as uint).to_str_radix(16u));
+                s.push_str((*b as uint).to_str_radix(16u).as_slice());
             }
-            s.into_owned()
+            s
         }
 
         while t < 64 {
@@ -636,7 +636,6 @@ officia deserunt mollit anim id est laborum.";
     struct Compound {
         x: u8,
         y: u64,
-        z: ~str,
     }
 
     #[bench]
@@ -644,7 +643,6 @@ officia deserunt mollit anim id est laborum.";
         let compound = Compound {
             x: 1,
             y: 2,
-            z: "foobarbaz".to_owned(),
         };
         b.iter(|| {
             assert_eq!(hash(&compound), 15783192367317361799);