diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-05-30 14:33:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-30 14:33:48 +0200 |
| commit | 0ed320bdb9dff0f26f682cd6c9ccd6bfbffe5df8 (patch) | |
| tree | b2aa9546006a30e5d1ae2c9dc1e03b1dc2df6340 /library/alloc/src/sync | |
| parent | 5c780b98d10f48d6255cf2deb2643194b9221c02 (diff) | |
| parent | cdb8e64bc78400f9366db3b556bb01f470855f55 (diff) | |
Rollup merge of #97494 - est31:remove_box_alloc_tests, r=Dylan-DPC
Use Box::new() instead of box syntax in library tests The tests inside `library/*` have no reason to use `box` syntax as they have 0 performance relevance. Therefore, we can safely remove them (instead of having to use alternatives like the one in #97293).
Diffstat (limited to 'library/alloc/src/sync')
| -rw-r--r-- | library/alloc/src/sync/tests.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/library/alloc/src/sync/tests.rs b/library/alloc/src/sync/tests.rs index 452a8877301..202d0e7f020 100644 --- a/library/alloc/src/sync/tests.rs +++ b/library/alloc/src/sync/tests.rs @@ -103,7 +103,7 @@ fn try_unwrap() { #[test] fn into_from_raw() { - let x = Arc::new(box "hello"); + let x = Arc::new(Box::new("hello")); let y = x.clone(); let x_ptr = Arc::into_raw(x); @@ -142,7 +142,7 @@ fn test_into_from_raw_unsized() { #[test] fn into_from_weak_raw() { - let x = Arc::new(box "hello"); + let x = Arc::new(Box::new("hello")); let y = Arc::downgrade(&x); let y_ptr = Weak::into_raw(y); @@ -467,7 +467,7 @@ fn test_clone_from_slice_panic() { #[test] fn test_from_box() { - let b: Box<u32> = box 123; + let b: Box<u32> = Box::new(123); let r: Arc<u32> = Arc::from(b); assert_eq!(*r, 123); @@ -496,7 +496,7 @@ fn test_from_box_trait() { use std::fmt::Display; use std::string::ToString; - let b: Box<dyn Display> = box 123; + let b: Box<dyn Display> = Box::new(123); let r: Arc<dyn Display> = Arc::from(b); assert_eq!(r.to_string(), "123"); @@ -506,7 +506,7 @@ fn test_from_box_trait() { fn test_from_box_trait_zero_sized() { use std::fmt::Debug; - let b: Box<dyn Debug> = box (); + let b: Box<dyn Debug> = Box::new(()); let r: Arc<dyn Debug> = Arc::from(b); assert_eq!(format!("{r:?}"), "()"); |
