]> git.lizzy.rs Git - rust.git/commitdiff
Switch to using `Box::new` in the tests in `alloc::boxed`.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 7 Jan 2015 22:04:12 +0000 (23:04 +0100)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 7 Jan 2015 23:41:49 +0000 (00:41 +0100)
src/liballoc/boxed.rs

index cec49fa6186ee724fd8f4b0a117906d4b8f7631c..f3ce50ec051aaad0a871587ee70247fc3ef85e92 100644 (file)
@@ -186,27 +186,27 @@ fn deref_mut(&mut self) -> &mut T { &mut **self }
 mod test {
     #[test]
     fn test_owned_clone() {
-        let a = box 5i;
+        let a = Box::new(5i);
         let b: Box<int> = a.clone();
         assert!(a == b);
     }
 
     #[test]
     fn any_move() {
-        let a = box 8u as Box<Any>;
-        let b = box Test as Box<Any>;
+        let a = Box::new(8u) as Box<Any>;
+        let b = Box::new(Test) as Box<Any>;
 
         match a.downcast::<uint>() {
-            Ok(a) => { assert!(a == box 8u); }
+            Ok(a) => { assert!(a == Box::new(8u)); }
             Err(..) => panic!()
         }
         match b.downcast::<Test>() {
-            Ok(a) => { assert!(a == box Test); }
+            Ok(a) => { assert!(a == Box::new(Test)); }
             Err(..) => panic!()
         }
 
-        let a = box 8u as Box<Any>;
-        let b = box Test as Box<Any>;
+        let a = Box::new(8u) as Box<Any>;
+        let b = Box::new(Test) as Box<Any>;
 
         assert!(a.downcast::<Box<Test>>().is_err());
         assert!(b.downcast::<Box<uint>>().is_err());
@@ -214,8 +214,8 @@ fn any_move() {
 
     #[test]
     fn test_show() {
-        let a = box 8u as Box<Any>;
-        let b = box Test as Box<Any>;
+        let a = Box::new(8u) as Box<Any>;
+        let b = Box::new(Test) as Box<Any>;
         let a_str = a.to_str();
         let b_str = b.to_str();
         assert_eq!(a_str, "Box<Any>");
@@ -232,6 +232,6 @@ fn test_show() {
     #[test]
     fn deref() {
         fn homura<T: Deref<Target=i32>>(_: T) { }
-        homura(box 765i32);
+        homura(Box::new(765i32));
     }
 }