From 3c86e9c2a4c5316b58c89bf7922ea8f8fc9e6af2 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 12 Apr 2024 02:17:16 +0900 Subject: [PATCH] Remove `as _` casts --- portable-atomic-util/src/arc.rs | 2 +- src/tests/helper.rs | 12 ++++++------ tests/api-test/src/helper.rs | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/portable-atomic-util/src/arc.rs b/portable-atomic-util/src/arc.rs index 443972dd..985cfe8d 100644 --- a/portable-atomic-util/src/arc.rs +++ b/portable-atomic-util/src/arc.rs @@ -522,7 +522,7 @@ impl Arc<[mem::MaybeUninit]> { let md_self = mem::ManuallyDrop::new(self); // SAFETY: [MaybeUninit] has the same layout as [T], and // the caller must ensure data is initialized. - unsafe { Arc::from_ptr(md_self.ptr.as_ptr() as _) } + unsafe { Arc::from_ptr(md_self.ptr.as_ptr() as *mut ArcInner<[T]>) } } } diff --git a/src/tests/helper.rs b/src/tests/helper.rs index c1e96763..ecdaa975 100644 --- a/src/tests/helper.rs +++ b/src/tests/helper.rs @@ -1341,7 +1341,7 @@ macro_rules! __test_atomic_ptr { let x = &mut 1; for &order in &test_helper::SWAP_ORDERINGS { assert_eq!(a.swap(x, order), ptr::null_mut()); - assert_eq!(a.swap(ptr::null_mut(), order), x as _); + assert_eq!(a.swap(ptr::null_mut(), order), x as *mut _); } } #[test] @@ -1357,12 +1357,12 @@ macro_rules! __test_atomic_ptr { a.compare_exchange(ptr::null_mut(), x, success, failure), Ok(ptr::null_mut()), ); - assert_eq!(a.load(Ordering::Relaxed), x as _); + assert_eq!(a.load(Ordering::Relaxed), x as *mut _); assert_eq!( a.compare_exchange(ptr::null_mut(), ptr::null_mut(), success, failure), - Err(x as _), + Err(x as *mut _), ); - assert_eq!(a.load(Ordering::Relaxed), x as _); + assert_eq!(a.load(Ordering::Relaxed), x as *mut _); } } #[test] @@ -1382,7 +1382,7 @@ macro_rules! __test_atomic_ptr { Err(x) => old = x, } } - assert_eq!(a.load(Ordering::Relaxed), x as _); + assert_eq!(a.load(Ordering::Relaxed), x as *mut _); } } }; @@ -2193,7 +2193,7 @@ macro_rules! __stress_test_acquire_release { s.spawn(|_| { for i in 0..n { b.store(i, Ordering::Relaxed); - a.$write(i as _, Ordering::$store_order); + a.$write(i as $int_type, Ordering::$store_order); } }); loop { diff --git a/tests/api-test/src/helper.rs b/tests/api-test/src/helper.rs index 4afd902f..7eb973e0 100644 --- a/tests/api-test/src/helper.rs +++ b/tests/api-test/src/helper.rs @@ -740,7 +740,7 @@ macro_rules! __test_atomic_ptr { let x = &mut 1; for &order in &test_helper::SWAP_ORDERINGS { assert_eq!(a.swap(x, order), core::ptr::null_mut()); - assert_eq!(a.swap(core::ptr::null_mut(), order), x as _); + assert_eq!(a.swap(core::ptr::null_mut(), order), x as *mut _); } } __run_test!(compare_exchange); @@ -752,7 +752,7 @@ macro_rules! __test_atomic_ptr { a.compare_exchange(core::ptr::null_mut(), x, success, failure), Ok(core::ptr::null_mut()), ); - assert_eq!(a.load(Ordering::Relaxed), x as _); + assert_eq!(a.load(Ordering::Relaxed), x as *mut _); assert_eq!( a.compare_exchange( core::ptr::null_mut(), @@ -760,9 +760,9 @@ macro_rules! __test_atomic_ptr { success, failure ), - Err(x as _), + Err(x as *mut _), ); - assert_eq!(a.load(Ordering::Relaxed), x as _); + assert_eq!(a.load(Ordering::Relaxed), x as *mut _); } } __run_test!(compare_exchange_weak); @@ -781,7 +781,7 @@ macro_rules! __test_atomic_ptr { Err(x) => old = x, } } - assert_eq!(a.load(Ordering::Relaxed), x as _); + assert_eq!(a.load(Ordering::Relaxed), x as *mut _); } } __run_test!(fetch_update);