Skip to content

Commit d2176d1

Browse files
committed
Use a cfg-attr to suppress the warning for using ATOMIC_USIZE_INIT in clippy
1 parent 6254772 commit d2176d1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ macro_rules! class {
1818
#[inline(always)]
1919
fn get_class(name: &str) -> Option<&'static $crate::runtime::Class> {
2020
unsafe {
21+
#[cfg_attr(feature = "cargo-clippy", allow(replace_consts))]
2122
static CLASS: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
2223
// `Relaxed` should be fine since `objc_getClass` is thread-safe.
2324
let ptr = CLASS.load(::std::sync::atomic::Ordering::Relaxed) as *const $crate::runtime::Class;
@@ -46,6 +47,7 @@ macro_rules! sel_impl {
4647
#[inline(always)]
4748
fn register_sel(name: &str) -> $crate::runtime::Sel {
4849
unsafe {
50+
#[cfg_attr(feature = "cargo-clippy", allow(replace_consts))]
4951
static SEL: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
5052
let ptr = SEL.load(::std::sync::atomic::Ordering::Relaxed) as *const ::std::os::raw::c_void;
5153
// It should be fine to use `Relaxed` ordering here because `sel_registerName` is

0 commit comments

Comments
 (0)