about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVictor Berger <victor.berger@m4x.org>2014-09-22 19:30:06 +0200
committerVictor Berger <victor.berger@m4x.org>2014-09-22 19:30:06 +0200
commit52ea83dddcc05c2e861b9de9316616df6a9228dc (patch)
tree691834c4f6304a1d3e9d347055a7b532bf50f7a0
parenteb58ac126e638287998959a20aa91ffa730b95c2 (diff)
downloadrust-52ea83dddcc05c2e861b9de9316616df6a9228dc.tar.gz
rust-52ea83dddcc05c2e861b9de9316616df6a9228dc.zip
Update calls of deprecated functions in macros.
Fallout of #17185.
-rw-r--r--src/liballoc/arc.rs6
-rw-r--r--src/libcollections/ringbuf.rs2
-rw-r--r--src/libcollections/slice.rs12
-rw-r--r--src/libcollections/smallintmap.rs16
-rw-r--r--src/libcollections/trie.rs4
-rw-r--r--src/libcoretest/cmp.rs1
-rw-r--r--src/libcoretest/option.rs1
-rw-r--r--src/libgetopts/lib.rs20
-rw-r--r--src/librustrt/local_data.rs2
-rw-r--r--src/libtest/lib.rs4
10 files changed, 38 insertions, 30 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index 0d9e4f0a1c2..39524ed547d 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -311,13 +311,13 @@ mod tests {
 
         task::spawn(proc() {
             let arc_v: Arc<Vec<int>> = rx.recv();
-            assert_eq!(*arc_v.get(3), 4);
+            assert_eq!((*arc_v)[3], 4);
         });
 
         tx.send(arc_v.clone());
 
-        assert_eq!(*arc_v.get(2), 3);
-        assert_eq!(*arc_v.get(4), 5);
+        assert_eq!((*arc_v)[2], 3);
+        assert_eq!((*arc_v)[4], 5);
 
         info!("{:?}", arc_v);
     }
diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs
index 90ee24eb587..02c8af2c470 100644
--- a/src/libcollections/ringbuf.rs
+++ b/src/libcollections/ringbuf.rs
@@ -542,6 +542,7 @@ mod tests {
     use vec::Vec;
 
     #[test]
+    #[allow(deprecated)]
     fn test_simple() {
         let mut d = RingBuf::new();
         assert_eq!(d.len(), 0u);
@@ -587,6 +588,7 @@ mod tests {
     }
 
     #[test]
+    #[allow(deprecated)]
     fn test_boxes() {
         let a: Gc<int> = box(GC) 5;
         let b: Gc<int> = box(GC) 72;
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 44fe962fad4..525dc9cbe80 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -904,6 +904,7 @@ mod tests {
     }
 
     #[test]
+    #[allow(deprecated)]
     fn test_initn() {
         let mut a = vec![11i, 12, 13];
         let b: &[int] = &[11, 12, 13];
@@ -1303,6 +1304,7 @@ mod tests {
     }
 
     #[test]
+    #[allow(deprecated)]
     fn test_bsearch_elem() {
         assert_eq!([1i,2,3,4,5].bsearch_elem(&5), Some(4));
         assert_eq!([1i,2,3,4,5].bsearch_elem(&4), Some(3));
@@ -1350,11 +1352,11 @@ mod tests {
     #[test]
     fn test_reverse() {
         let mut v: Vec<int> = vec![10i, 20];
-        assert_eq!(*v.get(0), 10);
-        assert_eq!(*v.get(1), 20);
+        assert_eq!(v[0], 10);
+        assert_eq!(v[1], 20);
         v.reverse();
-        assert_eq!(*v.get(0), 20);
-        assert_eq!(*v.get(1), 10);
+        assert_eq!(v[0], 20);
+        assert_eq!(v[1], 10);
 
         let mut v3: Vec<int> = vec![];
         v3.reverse();
@@ -1462,6 +1464,7 @@ mod tests {
     }
 
     #[test]
+    #[allow(deprecated)]
     fn test_shift() {
         let mut x = vec![1i, 2, 3];
         assert_eq!(x.shift(), Some(1));
@@ -1901,6 +1904,7 @@ mod tests {
     }
 
     #[test]
+    #[allow(deprecated)]
     fn test_copy_from() {
         let mut a = [1i,2,3,4,5];
         let b = [6i,7,8];
diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs
index 31d3415ef48..7d66d202d5f 100644
--- a/src/libcollections/smallintmap.rs
+++ b/src/libcollections/smallintmap.rs
@@ -452,7 +452,7 @@ impl<V> Index<uint, V> for SmallIntMap<V> {
 }*/
 
 macro_rules! iterator {
-    (impl $name:ident -> $elem:ty, $getter:ident) => {
+    (impl $name:ident -> $elem:ty, $($getter:ident),+) => {
         impl<'a, T> Iterator<$elem> for $name<'a, T> {
             #[inline]
             fn next(&mut self) -> Option<$elem> {
@@ -462,7 +462,7 @@ macro_rules! iterator {
                             if elem.is_some() {
                                 let index = self.front;
                                 self.front += 1;
-                                return Some((index, elem. $getter ()));
+                                return Some((index, elem $(. $getter ())+));
                             }
                         }
                         _ => ()
@@ -481,7 +481,7 @@ macro_rules! iterator {
 }
 
 macro_rules! double_ended_iterator {
-    (impl $name:ident -> $elem:ty, $getter:ident) => {
+    (impl $name:ident -> $elem:ty, $($getter:ident),+) => {
         impl<'a, T> DoubleEndedIterator<$elem> for $name<'a, T> {
             #[inline]
             fn next_back(&mut self) -> Option<$elem> {
@@ -490,7 +490,7 @@ macro_rules! double_ended_iterator {
                         Some(elem) => {
                             if elem.is_some() {
                                 self.back -= 1;
-                                return Some((self.back, elem. $getter ()));
+                                return Some((self.back, elem$(. $getter ())+));
                             }
                         }
                         _ => ()
@@ -510,8 +510,8 @@ pub struct Entries<'a, T:'a> {
     iter: slice::Items<'a, Option<T>>
 }
 
-iterator!(impl Entries -> (uint, &'a T), get_ref)
-double_ended_iterator!(impl Entries -> (uint, &'a T), get_ref)
+iterator!(impl Entries -> (uint, &'a T), as_ref, unwrap)
+double_ended_iterator!(impl Entries -> (uint, &'a T), as_ref, unwrap)
 
 /// Forward iterator over the key-value pairs of a map, with the
 /// values being mutable.
@@ -521,8 +521,8 @@ pub struct MutEntries<'a, T:'a> {
     iter: slice::MutItems<'a, Option<T>>
 }
 
-iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
-double_ended_iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
+iterator!(impl MutEntries -> (uint, &'a mut T), as_mut, unwrap)
+double_ended_iterator!(impl MutEntries -> (uint, &'a mut T), as_mut, unwrap)
 
 /// Forward iterator over the keys of a map
 pub type Keys<'a, T> =
diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs
index 99e5899dc15..e9981790f7d 100644
--- a/src/libcollections/trie.rs
+++ b/src/libcollections/trie.rs
@@ -434,7 +434,7 @@ impl<T> TrieMap<T> {
     fn bound_mut<'a>(&'a mut self, key: uint, upper: bool) -> MutEntries<'a, T> {
         bound!(MutEntries, self = self,
                key = key, is_upper = upper,
-               slice_from = mut_slice_from, iter = mut_iter,
+               slice_from = slice_from_mut, iter = iter_mut,
                mutability = mut)
     }
 
@@ -1020,7 +1020,7 @@ macro_rules! iterator_impl {
 }
 
 iterator_impl! { Entries, iter = iter, mutability = }
-iterator_impl! { MutEntries, iter = mut_iter, mutability = mut }
+iterator_impl! { MutEntries, iter = iter_mut, mutability = mut }
 
 /// A forward iterator over a set.
 pub struct SetItems<'a> {
diff --git a/src/libcoretest/cmp.rs b/src/libcoretest/cmp.rs
index 4a38bb33d33..a25d205e225 100644
--- a/src/libcoretest/cmp.rs
+++ b/src/libcoretest/cmp.rs
@@ -42,6 +42,7 @@ fn test_ordering_order() {
 }
 
 #[test]
+#[allow(deprecated)]
 fn test_lexical_ordering() {
     fn t(o1: Ordering, o2: Ordering, e: Ordering) {
         assert_eq!(lexical_ordering(o1, o2), e);
diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs
index ed7fc3aa4f2..3f150b3d136 100644
--- a/src/libcoretest/option.rs
+++ b/src/libcoretest/option.rs
@@ -244,6 +244,7 @@ fn test_ord() {
 }
 
 #[test]
+#[allow(deprecated)]
 fn test_mutate() {
     let mut x = Some(3i);
     assert!(x.mutate(|i| i+1));
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs
index f95ecb412d1..31a1bf048ce 100644
--- a/src/libgetopts/lib.rs
+++ b/src/libgetopts/lib.rs
@@ -1142,7 +1142,7 @@ mod tests {
           Ok(ref m) => {
             // The next variable after the flag is just a free argument
 
-            assert!(*m.free.get(0) == "20".to_string());
+            assert!(m.free[0] == "20".to_string());
           }
           _ => fail!()
         }
@@ -1298,8 +1298,8 @@ mod tests {
               assert!(m.opt_present("t"));
               assert_eq!(m.opt_str("t").unwrap(), "20".to_string());
               let pair = m.opt_strs("test");
-              assert!(*pair.get(0) == "20".to_string());
-              assert!(*pair.get(1) == "30".to_string());
+              assert!(pair[0] == "20".to_string());
+              assert!(pair[1] == "30".to_string());
           }
           _ => fail!()
         }
@@ -1351,19 +1351,19 @@ mod tests {
         let rs = getopts(args.as_slice(), opts.as_slice());
         match rs {
           Ok(ref m) => {
-            assert!(*m.free.get(0) == "prog".to_string());
-            assert!(*m.free.get(1) == "free1".to_string());
+            assert!(m.free[0] == "prog".to_string());
+            assert!(m.free[1] == "free1".to_string());
             assert_eq!(m.opt_str("s").unwrap(), "20".to_string());
-            assert!(*m.free.get(2) == "free2".to_string());
+            assert!(m.free[2] == "free2".to_string());
             assert!((m.opt_present("flag")));
             assert_eq!(m.opt_str("long").unwrap(), "30".to_string());
             assert!((m.opt_present("f")));
             let pair = m.opt_strs("m");
-            assert!(*pair.get(0) == "40".to_string());
-            assert!(*pair.get(1) == "50".to_string());
+            assert!(pair[0] == "40".to_string());
+            assert!(pair[1] == "50".to_string());
             let pair = m.opt_strs("n");
-            assert!(*pair.get(0) == "-A B".to_string());
-            assert!(*pair.get(1) == "-60 70".to_string());
+            assert!(pair[0] == "-A B".to_string());
+            assert!(pair[1] == "-60 70".to_string());
             assert!((!m.opt_present("notpresent")));
           }
           _ => fail!()
diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs
index ba5a4dc3f21..e7ce5b7dca8 100644
--- a/src/librustrt/local_data.rs
+++ b/src/librustrt/local_data.rs
@@ -423,7 +423,7 @@ mod tests {
             // TLD shouldn't carry over.
             assert!(my_key.get().is_none());
             my_key.replace(Some("child data".to_string()));
-            assert!(my_key.get().get_ref().as_slice() == "child data");
+            assert!(my_key.get().as_ref().unwrap().as_slice() == "child data");
             // should be cleaned up for us
         });
 
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 758496fa2c2..43a1899f45e 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -1519,9 +1519,9 @@ mod tests {
         let filtered = filter_tests(&opts, tests);
 
         assert_eq!(filtered.len(), 1);
-        assert_eq!(filtered.get(0).desc.name.to_string(),
+        assert_eq!(filtered[0].desc.name.to_string(),
                    "1".to_string());
-        assert!(filtered.get(0).desc.ignore == false);
+        assert!(filtered[0].desc.ignore == false);
     }
 
     #[test]