diff --git a/src/barrier.rs b/src/barrier.rs index f6ace1e..aab2be6 100644 --- a/src/barrier.rs +++ b/src/barrier.rs @@ -210,7 +210,7 @@ impl EventListenerFuture for BarrierWaitInner<'_> { // We are the last one. state.count = 0; state.generation_id = state.generation_id.wrapping_add(1); - this.barrier.event.notify(core::usize::MAX); + this.barrier.event.notify(usize::MAX); return Poll::Ready(BarrierWaitResult { is_leader: true }); } } diff --git a/src/mutex.rs b/src/mutex.rs index 85c43c5..b2aa4cc 100644 --- a/src/mutex.rs +++ b/src/mutex.rs @@ -5,7 +5,6 @@ use core::marker::{PhantomData, PhantomPinned}; use core::ops::{Deref, DerefMut}; use core::pin::Pin; use core::task::Poll; -use core::usize; use alloc::sync::Arc; @@ -314,7 +313,7 @@ impl From for Mutex { } } -impl Default for Mutex { +impl Default for Mutex { fn default() -> Mutex { Mutex::new(Default::default()) } diff --git a/src/once_cell.rs b/src/once_cell.rs index 6554292..14f020f 100644 --- a/src/once_cell.rs +++ b/src/once_cell.rs @@ -476,6 +476,8 @@ impl OnceCell { /// # }); /// ``` pub async fn get_or_init>(&self, closure: impl FnOnce() -> Fut) -> &T { + // false positive: https://github.com/rust-lang/rust/issues/129352 + #[allow(unreachable_patterns)] match self .get_or_try_init(move || async move { let result: Result = Ok(closure().await); @@ -517,6 +519,9 @@ impl OnceCell { let result: Result = Ok(closure()); result }); + + // false positive: https://github.com/rust-lang/rust/issues/129352 + #[allow(unreachable_patterns)] match result { Ok(value) => value, Err(infallible) => match infallible {}, @@ -659,8 +664,8 @@ impl OnceCell { .store(State::Initialized.into(), Ordering::Release); // Notify the listeners that the value is initialized. - self.active_initializers.notify_additional(core::usize::MAX); - self.passive_waiters.notify_additional(core::usize::MAX); + self.active_initializers.notify_additional(usize::MAX); + self.passive_waiters.notify_additional(usize::MAX); return Ok(()); } diff --git a/src/rwlock.rs b/src/rwlock.rs index 67b06d5..d446ca4 100644 --- a/src/rwlock.rs +++ b/src/rwlock.rs @@ -701,7 +701,7 @@ impl From for RwLock { } } -impl Default for RwLock { +impl Default for RwLock { #[inline] fn default() -> RwLock { RwLock::new(Default::default()) diff --git a/src/rwlock/raw.rs b/src/rwlock/raw.rs index c867ed9..d5c6d6b 100644 --- a/src/rwlock/raw.rs +++ b/src/rwlock/raw.rs @@ -69,7 +69,7 @@ impl RawRwLock { } // Make sure the number of readers doesn't overflow. - if state > core::isize::MAX as usize { + if state > isize::MAX as usize { crate::abort(); } @@ -111,7 +111,7 @@ impl RawRwLock { let mut state = self.state.load(Ordering::Acquire); // Make sure the number of readers doesn't overflow. - if state > core::isize::MAX as usize { + if state > isize::MAX as usize { crate::abort(); } @@ -320,7 +320,7 @@ impl<'a> EventListenerFuture for RawRead<'a> { loop { if *this.state & WRITER_BIT == 0 { // Make sure the number of readers doesn't overflow. - if *this.state > core::isize::MAX as usize { + if *this.state > isize::MAX as usize { crate::abort(); } @@ -390,7 +390,7 @@ impl<'a> EventListenerFuture for RawUpgradableRead<'a> { let mut state = this.lock.state.load(Ordering::Acquire); // Make sure the number of readers doesn't overflow. - if state > core::isize::MAX as usize { + if state > isize::MAX as usize { crate::abort(); }