Skip to content

Commit fa7ca43

Browse files
alexboolSSheldon
authored andcommitted
Remove usages of deprecated ATOMIC_USIZE_INIT (#75)
1 parent 4f8f67a commit fa7ca43

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/macros.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ macro_rules! class {
1919
#[inline(always)]
2020
fn get_class(name: &str) -> Option<&'static $crate::runtime::Class> {
2121
unsafe {
22-
#[cfg_attr(feature = "cargo-clippy", allow(replace_consts))]
23-
static CLASS: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
22+
static CLASS: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0);
2423
// `Relaxed` should be fine since `objc_getClass` is thread-safe.
2524
let ptr = CLASS.load(::std::sync::atomic::Ordering::Relaxed) as *const $crate::runtime::Class;
2625
if ptr.is_null() {
@@ -49,8 +48,7 @@ macro_rules! sel_impl {
4948
#[inline(always)]
5049
fn register_sel(name: &str) -> $crate::runtime::Sel {
5150
unsafe {
52-
#[cfg_attr(feature = "cargo-clippy", allow(replace_consts))]
53-
static SEL: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
51+
static SEL: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0);
5452
let ptr = SEL.load(::std::sync::atomic::Ordering::Relaxed) as *const ::std::os::raw::c_void;
5553
// It should be fine to use `Relaxed` ordering here because `sel_registerName` is
5654
// thread-safe.

0 commit comments

Comments
 (0)