summary refs log tree commit diff
path: root/library/std/src/sync
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2022-05-29 00:25:32 +0200
committerest31 <MTest31@outlook.com>2022-05-29 01:44:11 +0200
commitd75c60f9a37c9b1810ddcdf19216da76319bdf04 (patch)
treedb61a2b833b4d163e0a90fcdda6d6dff983ed9cd /library/std/src/sync
parent7230a15c32d01e1653d98c39ddd79097a59b550c (diff)
downloadrust-d75c60f9a37c9b1810ddcdf19216da76319bdf04.tar.gz
rust-d75c60f9a37c9b1810ddcdf19216da76319bdf04.zip
Use Box::new() instead of box syntax in std tests
Diffstat (limited to 'library/std/src/sync')
-rw-r--r--library/std/src/sync/mpsc/mpsc_queue/tests.rs4
-rw-r--r--library/std/src/sync/mpsc/spsc_queue/tests.rs4
-rw-r--r--library/std/src/sync/mpsc/sync_tests.rs12
-rw-r--r--library/std/src/sync/mpsc/tests.rs14
4 files changed, 17 insertions, 17 deletions
diff --git a/library/std/src/sync/mpsc/mpsc_queue/tests.rs b/library/std/src/sync/mpsc/mpsc_queue/tests.rs
index 348b83424b0..9f4f31ed051 100644
--- a/library/std/src/sync/mpsc/mpsc_queue/tests.rs
+++ b/library/std/src/sync/mpsc/mpsc_queue/tests.rs
@@ -6,8 +6,8 @@ use crate::thread;
 #[test]
 fn test_full() {
     let q: Queue<Box<_>> = Queue::new();
-    q.push(box 1);
-    q.push(box 2);
+    q.push(Box::new(1));
+    q.push(Box::new(2));
 }
 
 #[test]
diff --git a/library/std/src/sync/mpsc/spsc_queue/tests.rs b/library/std/src/sync/mpsc/spsc_queue/tests.rs
index e4fd15cbbde..467ef3dbdcb 100644
--- a/library/std/src/sync/mpsc/spsc_queue/tests.rs
+++ b/library/std/src/sync/mpsc/spsc_queue/tests.rs
@@ -47,8 +47,8 @@ fn peek() {
 fn drop_full() {
     unsafe {
         let q: Queue<Box<_>> = Queue::with_additions(0, (), ());
-        q.push(box 1);
-        q.push(box 2);
+        q.push(Box::new(1));
+        q.push(Box::new(2));
     }
 }
 
diff --git a/library/std/src/sync/mpsc/sync_tests.rs b/library/std/src/sync/mpsc/sync_tests.rs
index 0052a38f7bb..e58649bab6e 100644
--- a/library/std/src/sync/mpsc/sync_tests.rs
+++ b/library/std/src/sync/mpsc/sync_tests.rs
@@ -20,7 +20,7 @@ fn smoke() {
 #[test]
 fn drop_full() {
     let (tx, _rx) = sync_channel::<Box<isize>>(1);
-    tx.send(box 1).unwrap();
+    tx.send(Box::new(1)).unwrap();
 }
 
 #[test]
@@ -238,7 +238,7 @@ fn oneshot_single_thread_send_port_close() {
     // Testing that the sender cleans up the payload if receiver is closed
     let (tx, rx) = sync_channel::<Box<i32>>(0);
     drop(rx);
-    assert!(tx.send(box 0).is_err());
+    assert!(tx.send(Box::new(0)).is_err());
 }
 
 #[test]
@@ -257,7 +257,7 @@ fn oneshot_single_thread_recv_chan_close() {
 #[test]
 fn oneshot_single_thread_send_then_recv() {
     let (tx, rx) = sync_channel::<Box<i32>>(1);
-    tx.send(box 10).unwrap();
+    tx.send(Box::new(10)).unwrap();
     assert!(*rx.recv().unwrap() == 10);
 }
 
@@ -333,7 +333,7 @@ fn oneshot_multi_task_recv_then_send() {
         assert!(*rx.recv().unwrap() == 10);
     });
 
-    tx.send(box 10).unwrap();
+    tx.send(Box::new(10)).unwrap();
 }
 
 #[test]
@@ -398,7 +398,7 @@ fn oneshot_multi_thread_send_recv_stress() {
     for _ in 0..stress_factor() {
         let (tx, rx) = sync_channel::<Box<i32>>(0);
         let _t = thread::spawn(move || {
-            tx.send(box 10).unwrap();
+            tx.send(Box::new(10)).unwrap();
         });
         assert!(*rx.recv().unwrap() == 10);
     }
@@ -418,7 +418,7 @@ fn stream_send_recv_stress() {
             }
 
             thread::spawn(move || {
-                tx.send(box i).unwrap();
+                tx.send(Box::new(i)).unwrap();
                 send(tx, i + 1);
             });
         }
diff --git a/library/std/src/sync/mpsc/tests.rs b/library/std/src/sync/mpsc/tests.rs
index 184ce193cbe..4deb3e59615 100644
--- a/library/std/src/sync/mpsc/tests.rs
+++ b/library/std/src/sync/mpsc/tests.rs
@@ -20,7 +20,7 @@ fn smoke() {
 #[test]
 fn drop_full() {
     let (tx, _rx) = channel::<Box<isize>>();
-    tx.send(box 1).unwrap();
+    tx.send(Box::new(1)).unwrap();
 }
 
 #[test]
@@ -28,7 +28,7 @@ fn drop_full_shared() {
     let (tx, _rx) = channel::<Box<isize>>();
     drop(tx.clone());
     drop(tx.clone());
-    tx.send(box 1).unwrap();
+    tx.send(Box::new(1)).unwrap();
 }
 
 #[test]
@@ -229,7 +229,7 @@ fn oneshot_single_thread_send_port_close() {
     // Testing that the sender cleans up the payload if receiver is closed
     let (tx, rx) = channel::<Box<i32>>();
     drop(rx);
-    assert!(tx.send(box 0).is_err());
+    assert!(tx.send(Box::new(0)).is_err());
 }
 
 #[test]
@@ -248,7 +248,7 @@ fn oneshot_single_thread_recv_chan_close() {
 #[test]
 fn oneshot_single_thread_send_then_recv() {
     let (tx, rx) = channel::<Box<i32>>();
-    tx.send(box 10).unwrap();
+    tx.send(Box::new(10)).unwrap();
     assert!(*rx.recv().unwrap() == 10);
 }
 
@@ -309,7 +309,7 @@ fn oneshot_multi_task_recv_then_send() {
         assert!(*rx.recv().unwrap() == 10);
     });
 
-    tx.send(box 10).unwrap();
+    tx.send(Box::new(10)).unwrap();
 }
 
 #[test]
@@ -374,7 +374,7 @@ fn oneshot_multi_thread_send_recv_stress() {
     for _ in 0..stress_factor() {
         let (tx, rx) = channel::<Box<isize>>();
         let _t = thread::spawn(move || {
-            tx.send(box 10).unwrap();
+            tx.send(Box::new(10)).unwrap();
         });
         assert!(*rx.recv().unwrap() == 10);
     }
@@ -394,7 +394,7 @@ fn stream_send_recv_stress() {
             }
 
             thread::spawn(move || {
-                tx.send(box i).unwrap();
+                tx.send(Box::new(i)).unwrap();
                 send(tx, i + 1);
             });
         }