Skip to content

Commit 2b18829

Browse files
committed
Drop futures::Stream impl
This isn't used. We could opt for implementing FusedFuture and FusedStream, but these traits seem incoherent [1] and are due to removal for futures-core 1.0 [2]. They're not needed, so just get rid of them. [1] rust-lang/futures-rs#2779 [2] rust-lang/futures-rs#2207
1 parent 03d973a commit 2b18829

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

src/atomic_waiter.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use core::sync::atomic::{AtomicBool, Ordering};
44
use core::task::{Context, Poll};
55

66
use futures::task::AtomicWaker;
7-
use futures::Stream;
87

98
/// Thin wrapper over [`futures::task::AtomicWaker`]. This represents a
109
/// Send + Sync Future that can be completed by calling its wake() method.
@@ -78,10 +77,3 @@ impl Future for AtomicWaiter {
7877
self.poll_const(cx)
7978
}
8079
}
81-
82-
impl Stream for AtomicWaiter {
83-
type Item = ();
84-
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
85-
self.poll(cx).map(Some)
86-
}
87-
}

src/lib.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ use core::ptr::null_mut;
77
use core::sync::atomic::{AtomicBool, AtomicPtr, Ordering};
88
use core::task::{Context, Poll};
99

10-
use futures::Stream;
11-
1210
pub mod atomic_waiter;
1311
use atomic_waiter::AtomicWaiter;
1412

@@ -221,28 +219,17 @@ impl<'m, const M: usize, T> Future for BorrowMutexLender<'m, M, T> {
221219
// And the same lend_waiter is polled in LendGuard, which could have
222220
// consumed both of those wakes. Before we start endlessly polling now,
223221
// check if we're ready
224-
if !self.mutex.borrowers.is_empty() {
225-
return Poll::Ready(());
226-
}
227-
228-
if self.mutex.lend_waiter.poll_const(cx) == Poll::Pending {
229-
return Poll::Pending;
222+
#[allow(clippy::collapsible_if)]
223+
if self.mutex.borrowers.is_empty() {
224+
if self.mutex.lend_waiter.poll_const(cx) == Poll::Pending {
225+
return Poll::Pending;
226+
}
230227
}
231228

232-
// even if dropped on the borrowing side, borrowers stay in the queue
233-
// until us (the lender) pops them
234-
assert!(!self.mutex.borrowers.is_empty());
235229
Poll::Ready(())
236230
}
237231
}
238232

239-
impl<'m, const M: usize, T> Stream for BorrowMutexLender<'m, M, T> {
240-
type Item = ();
241-
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
242-
self.poll(cx).map(Some)
243-
}
244-
}
245-
246233
pub struct BorrowMutexLendGuard<'l, const M: usize, T> {
247234
mutex: *const BorrowMutex<M, T>,
248235
borrow: &'l BorrowMutexRef,

0 commit comments

Comments
 (0)