]> git.lizzy.rs Git - rust.git/blobdiff - library/alloc/tests/slice.rs
Rollup merge of #98429 - b-naber:use-correct-substs-discriminant-cast, r=lcnr
[rust.git] / library / alloc / tests / slice.rs
index b027a25a146bcf97b1dc61d3df2c4d96ebbab711..21f894343be097394aee870a5b71f83fec2f64ab 100644 (file)
@@ -268,9 +268,9 @@ fn test_swap_remove_fail() {
 fn test_swap_remove_noncopyable() {
     // Tests that we don't accidentally run destructors twice.
     let mut v: Vec<Box<_>> = Vec::new();
-    v.push(box 0);
-    v.push(box 0);
-    v.push(box 0);
+    v.push(Box::new(0));
+    v.push(Box::new(0));
+    v.push(Box::new(0));
     let mut _e = v.swap_remove(0);
     assert_eq!(v.len(), 2);
     _e = v.swap_remove(1);
@@ -296,7 +296,7 @@ fn test_push() {
 
 #[test]
 fn test_truncate() {
-    let mut v: Vec<Box<_>> = vec![box 6, box 5, box 4];
+    let mut v: Vec<Box<_>> = vec![Box::new(6), Box::new(5), Box::new(4)];
     v.truncate(1);
     let v = v;
     assert_eq!(v.len(), 1);
@@ -306,7 +306,7 @@ fn test_truncate() {
 
 #[test]
 fn test_clear() {
-    let mut v: Vec<Box<_>> = vec![box 6, box 5, box 4];
+    let mut v: Vec<Box<_>> = vec![Box::new(6), Box::new(5), Box::new(4)];
     v.clear();
     assert_eq!(v.len(), 0);
     // If the unsafe block didn't drop things properly, we blow up here.
@@ -1516,14 +1516,14 @@ fn test_mut_last() {
 
 #[test]
 fn test_to_vec() {
-    let xs: Box<_> = box [1, 2, 3];
+    let xs: Box<_> = Box::new([1, 2, 3]);
     let ys = xs.to_vec();
     assert_eq!(ys, [1, 2, 3]);
 }
 
 #[test]
 fn test_in_place_iterator_specialization() {
-    let src: Box<[usize]> = box [1, 2, 3];
+    let src: Box<[usize]> = Box::new([1, 2, 3]);
     let src_ptr = src.as_ptr();
     let sink: Box<_> = src.into_vec().into_iter().map(std::convert::identity).collect();
     let sink_ptr = sink.as_ptr();