From 3fd6bfa8f7a1d193316956b5be8818c47bb874b7 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 7 Jan 2015 23:04:12 +0100 Subject: [PATCH] Switch to using `Box::new` in the tests in `alloc::boxed`. --- src/liballoc/boxed.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index cec49fa6186..f3ce50ec051 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -186,27 +186,27 @@ impl DerefMut for Box { mod test { #[test] fn test_owned_clone() { - let a = box 5i; + let a = Box::new(5i); let b: Box = a.clone(); assert!(a == b); } #[test] fn any_move() { - let a = box 8u as Box; - let b = box Test as Box; + let a = Box::new(8u) as Box; + let b = Box::new(Test) as Box; match a.downcast::() { - Ok(a) => { assert!(a == box 8u); } + Ok(a) => { assert!(a == Box::new(8u)); } Err(..) => panic!() } match b.downcast::() { - Ok(a) => { assert!(a == box Test); } + Ok(a) => { assert!(a == Box::new(Test)); } Err(..) => panic!() } - let a = box 8u as Box; - let b = box Test as Box; + let a = Box::new(8u) as Box; + let b = Box::new(Test) as Box; assert!(a.downcast::>().is_err()); assert!(b.downcast::>().is_err()); @@ -214,8 +214,8 @@ mod test { #[test] fn test_show() { - let a = box 8u as Box; - let b = box Test as Box; + let a = Box::new(8u) as Box; + let b = Box::new(Test) as Box; let a_str = a.to_str(); let b_str = b.to_str(); assert_eq!(a_str, "Box"); @@ -232,6 +232,6 @@ mod test { #[test] fn deref() { fn homura>(_: T) { } - homura(box 765i32); + homura(Box::new(765i32)); } }