Skip to content

Commit 3fd6bfa

Browse files
committed
Switch to using Box::new in the tests in alloc::boxed.
1 parent b57b0e0 commit 3fd6bfa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/liballoc/boxed.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,36 +186,36 @@ impl<T: ?Sized> DerefMut for Box<T> {
186186
mod test {
187187
#[test]
188188
fn test_owned_clone() {
189-
let a = box 5i;
189+
let a = Box::new(5i);
190190
let b: Box<int> = a.clone();
191191
assert!(a == b);
192192
}
193193

194194
#[test]
195195
fn any_move() {
196-
let a = box 8u as Box<Any>;
197-
let b = box Test as Box<Any>;
196+
let a = Box::new(8u) as Box<Any>;
197+
let b = Box::new(Test) as Box<Any>;
198198

199199
match a.downcast::<uint>() {
200-
Ok(a) => { assert!(a == box 8u); }
200+
Ok(a) => { assert!(a == Box::new(8u)); }
201201
Err(..) => panic!()
202202
}
203203
match b.downcast::<Test>() {
204-
Ok(a) => { assert!(a == box Test); }
204+
Ok(a) => { assert!(a == Box::new(Test)); }
205205
Err(..) => panic!()
206206
}
207207

208-
let a = box 8u as Box<Any>;
209-
let b = box Test as Box<Any>;
208+
let a = Box::new(8u) as Box<Any>;
209+
let b = Box::new(Test) as Box<Any>;
210210

211211
assert!(a.downcast::<Box<Test>>().is_err());
212212
assert!(b.downcast::<Box<uint>>().is_err());
213213
}
214214

215215
#[test]
216216
fn test_show() {
217-
let a = box 8u as Box<Any>;
218-
let b = box Test as Box<Any>;
217+
let a = Box::new(8u) as Box<Any>;
218+
let b = Box::new(Test) as Box<Any>;
219219
let a_str = a.to_str();
220220
let b_str = b.to_str();
221221
assert_eq!(a_str, "Box<Any>");
@@ -232,6 +232,6 @@ mod test {
232232
#[test]
233233
fn deref() {
234234
fn homura<T: Deref<Target=i32>>(_: T) { }
235-
homura(box 765i32);
235+
homura(Box::new(765i32));
236236
}
237237
}

0 commit comments

Comments
 (0)