]> git.lizzy.rs Git - rust.git/blobdiff - src/libcollections/lru_cache.rs
Replace all ~"" with "".to_owned()
[rust.git] / src / libcollections / lru_cache.rs
index 87b1fee1d27d9e1d018fc7dc553578a9a4328274..fc95ba6d95a64ffe4ebbdefc48b152de6c0f0e94 100644 (file)
@@ -295,22 +295,22 @@ fn test_put_and_get() {
     #[test]
     fn test_put_update() {
         let mut cache: LruCache<~str, Vec<u8>> = LruCache::new(1);
-        cache.put(~"1", vec![10, 10]);
-        cache.put(~"1", vec![10, 19]);
-        assert_opt_eq(cache.get(&~"1"), vec![10, 19]);
+        cache.put("1".to_owned(), vec![10, 10]);
+        cache.put("1".to_owned(), vec![10, 19]);
+        assert_opt_eq(cache.get(&"1".to_owned()), vec![10, 19]);
         assert_eq!(cache.len(), 1);
     }
 
     #[test]
     fn test_expire_lru() {
         let mut cache: LruCache<~str, ~str> = LruCache::new(2);
-        cache.put(~"foo1", ~"bar1");
-        cache.put(~"foo2", ~"bar2");
-        cache.put(~"foo3", ~"bar3");
-        assert!(cache.get(&~"foo1").is_none());
-        cache.put(~"foo2", ~"bar2update");
-        cache.put(~"foo4", ~"bar4");
-        assert!(cache.get(&~"foo3").is_none());
+        cache.put("foo1".to_owned(), "bar1".to_owned());
+        cache.put("foo2".to_owned(), "bar2".to_owned());
+        cache.put("foo3".to_owned(), "bar3".to_owned());
+        assert!(cache.get(&"foo1".to_owned()).is_none());
+        cache.put("foo2".to_owned(), "bar2update".to_owned());
+        cache.put("foo4".to_owned(), "bar4".to_owned());
+        assert!(cache.get(&"foo3".to_owned()).is_none());
     }
 
     #[test]
@@ -343,15 +343,15 @@ fn test_to_str() {
         cache.put(1, 10);
         cache.put(2, 20);
         cache.put(3, 30);
-        assert_eq!(cache.to_str(), ~"{3: 30, 2: 20, 1: 10}");
+        assert_eq!(cache.to_str(), "{3: 30, 2: 20, 1: 10}".to_owned());
         cache.put(2, 22);
-        assert_eq!(cache.to_str(), ~"{2: 22, 3: 30, 1: 10}");
+        assert_eq!(cache.to_str(), "{2: 22, 3: 30, 1: 10}".to_owned());
         cache.put(6, 60);
-        assert_eq!(cache.to_str(), ~"{6: 60, 2: 22, 3: 30}");
+        assert_eq!(cache.to_str(), "{6: 60, 2: 22, 3: 30}".to_owned());
         cache.get(&3);
-        assert_eq!(cache.to_str(), ~"{3: 30, 6: 60, 2: 22}");
+        assert_eq!(cache.to_str(), "{3: 30, 6: 60, 2: 22}".to_owned());
         cache.change_capacity(2);
-        assert_eq!(cache.to_str(), ~"{3: 30, 6: 60}");
+        assert_eq!(cache.to_str(), "{3: 30, 6: 60}".to_owned());
     }
 
     #[test]
@@ -362,6 +362,6 @@ fn test_clear() {
         cache.clear();
         assert!(cache.get(&1).is_none());
         assert!(cache.get(&2).is_none());
-        assert_eq!(cache.to_str(), ~"{}");
+        assert_eq!(cache.to_str(), "{}".to_owned());
     }
 }