]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/overload-index-operator.rs
Replace all ~"" with "".to_owned()
[rust.git] / src / test / run-pass / overload-index-operator.rs
index 0f83a8e730e8590273c2272765b5d0a6d7115f92..b72c4f92ea3e796cf73641c725b712759a800f77 100644 (file)
@@ -14,8 +14,7 @@
 use std::ops::Index;
 
 struct AssociationList<K,V> {
-    pairs: ~[AssociationPair<K,V>]
-}
+    pairs: Vec<AssociationPair<K,V>> }
 
 #[deriving(Clone)]
 struct AssociationPair<K,V> {
@@ -36,15 +35,15 @@ fn index(&self, index: &K) -> V {
                 return pair.value.clone();
             }
         }
-        fail!("No value found for key: %?", index);
+        fail!("No value found for key: {:?}", index);
     }
 }
 
 pub fn main() {
-    let foo = ~"foo";
-    let bar = ~"bar";
+    let foo = "foo".to_owned();
+    let bar = "bar".to_owned();
 
-    let mut list = AssociationList {pairs: ~[]};
+    let mut list = AssociationList {pairs: Vec::new()};
     list.push(foo.clone(), 22);
     list.push(bar.clone(), 44);