chore: Fix CI errors

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2024-02-11 11:25:39 -08:00
parent 4820cece7c
commit 898ff46ac5
No known key found for this signature in database
GPG Key ID: 2FE69973CFD64832
4 changed files with 16 additions and 18 deletions

View File

@ -7,7 +7,7 @@ use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::sync::cell::UnsafeCell;
#[allow(unused_imports)]
use crate::sync::prelude::*;
use crate::{busy_wait, PopError, PushError, ForcePushError};
use crate::{busy_wait, ForcePushError, PopError, PushError};
/// A slot in a queue.
struct Slot<T> {
@ -115,9 +115,7 @@ impl<T> Bounded<T> {
// SAFETY: We know this is initialized, since it's covered by the current queue.
let old = unsafe {
slot.value
.get()
.replace(MaybeUninit::new(value))
.assume_init()
.with_mut(|slot| slot.replace(MaybeUninit::new(value)).assume_init())
};
// Update the stamp.

View File

@ -182,36 +182,36 @@ impl<T> ConcurrentQueue<T> {
}
/// Push an element into the queue, potentially displacing another element.
///
///
/// Attempts to push an element into the queue. If the queue is full, one item from the
/// queue is replaced with the provided item. The displaced item is returned as `Some(T)`.
/// If the queue is closed, an error is returned.
///
///
/// # Examples
///
///
/// ```
/// use concurrent_queue::{ConcurrentQueue, ForcePushError, PushError};
///
///
/// let q = ConcurrentQueue::bounded(3);
///
///
/// // We can push to the queue.
/// for i in 1..=3 {
/// assert_eq!(q.force_push(i), Ok(None));
/// }
///
///
/// // Push errors because the queue is now full.
/// assert_eq!(q.push(4), Err(PushError::Full(4)));
///
///
/// // Pushing a new value replaces the old ones.
/// assert_eq!(q.force_push(5), Ok(Some(1)));
/// assert_eq!(q.force_push(6), Ok(Some(2)));
///
///
/// // Close the queue to stop further pushes.
/// q.close();
///
///
/// // Pushing will return an error.
/// assert_eq!(q.force_push(7), Err(ForcePushError(7)));
///
///
/// // Popping items will return the force-pushed ones.
/// assert_eq!(q.pop(), Ok(3));
/// assert_eq!(q.pop(), Ok(5));
@ -224,8 +224,8 @@ impl<T> ConcurrentQueue<T> {
Inner::Unbounded(q) => match q.push(value) {
Ok(()) => Ok(None),
Err(PushError::Closed(value)) => Err(ForcePushError(value)),
Err(PushError::Full(_)) => unreachable!()
}
Err(PushError::Full(_)) => unreachable!(),
},
}
}

View File

@ -5,7 +5,7 @@ use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::sync::cell::UnsafeCell;
#[allow(unused_imports)]
use crate::sync::prelude::*;
use crate::{busy_wait, PopError, PushError, ForcePushError};
use crate::{busy_wait, ForcePushError, PopError, PushError};
const LOCKED: usize = 1 << 0;
const PUSHED: usize = 1 << 1;

View File

@ -1,6 +1,6 @@
#![allow(clippy::bool_assert_comparison)]
use concurrent_queue::{ConcurrentQueue, PopError, PushError, ForcePushError};
use concurrent_queue::{ConcurrentQueue, ForcePushError, PopError, PushError};
#[cfg(not(target_family = "wasm"))]
use easy_parallel::Parallel;