Skip to content

Commit 853409a

Browse files
committed
Fix Clippy lints
1 parent 4747ed8 commit 853409a

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

blocking/src/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub trait Semaphore: Default {
3737
/// + on timeout - `false`.
3838
fn take(&self, timeout: Option<Duration>) -> bool;
3939

40-
fn take_iter(&self, timeout: Option<Duration>) -> TakeIter<Self> {
40+
fn take_iter(&self, timeout: Option<Duration>) -> TakeIter<'_, Self> {
4141
TakeIter {
4242
reset: false,
4343
semaphore: self,

src/traits/consumer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub trait Consumer: Observer {
3030
}
3131

3232
/// Provides a direct access to the ring buffer occupied memory.
33-
/// The difference from [`Self::as_slices`] is that this method provides slices of [`MaybeUninit`], so items may be moved out of slices.
33+
/// The difference from [`Self::as_slices`] is that this method provides slices of [`MaybeUninit`], so items may be moved out of slices.
3434
///
3535
/// Returns a pair of slices of stored items, the second one may be empty.
3636
/// Elements with lower indices in slice are older. First slice contains older items that second one.
@@ -185,7 +185,7 @@ pub trait Consumer: Observer {
185185
}
186186

187187
/// Returns an iterator that removes items one by one from the ring buffer.
188-
fn pop_iter(&mut self) -> PopIter<Self> {
188+
fn pop_iter(&mut self) -> PopIter<'_, Self> {
189189
PopIter::new(self)
190190
}
191191

@@ -260,7 +260,7 @@ pub trait Consumer: Observer {
260260
/// + `None`: ring buffer is full or `count` is `0`. In this case `write` isn't called at all.
261261
/// + `Some(Ok(n))`: `write` succeeded. `n` is number of bytes been written. `n == 0` means that `write` also returned `0`.
262262
/// + `Some(Err(e))`: `write` is failed and `e` is original error. In this case it is guaranteed that no items was written to the writer.
263-
/// To achieve this we write only one contiguous slice at once. So this call may write less than `occupied_len` items even if the writer is ready to get more.
263+
/// To achieve this we write only one contiguous slice at once. So this call may write less than `occupied_len` items even if the writer is ready to get more.
264264
fn write_into<S: Write>(&mut self, writer: &mut S, count: Option<usize>) -> Option<io::Result<usize>>
265265
where
266266
Self: Consumer<Item = u8>,

src/traits/observer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub trait Observer {
3535
/// # Safety
3636
///
3737
/// There must not exist overlapping slices at the same time.
38+
#[allow(clippy::mut_from_ref)]
3839
unsafe fn unsafe_slices_mut(&self, start: usize, end: usize) -> (&mut [MaybeUninit<Self::Item>], &mut [MaybeUninit<Self::Item>]);
3940

4041
/// Whether read end is held by consumer.

0 commit comments

Comments
 (0)