Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy fixes #2618

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions futures-util/benches/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ fn select_streams(b: &mut Bencher) {
let stream6 = repeat(6).take(STREAM_COUNT);
let stream7 = repeat(7).take(STREAM_COUNT);
let count = block_on(async {
let count = select(
select(
stream1,
select(
stream2,
select(stream3, select(stream4, select(stream5, select(stream6, stream7)))),
),
)
.count()
.await;
count
.await
});
assert_eq!(count, STREAM_COUNT * 7);
});
Expand Down
4 changes: 3 additions & 1 deletion futures-util/src/future/future/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ where
fn record_waker(&self, waker_key: &mut usize, cx: &mut Context<'_>) {
let mut wakers_guard = self.notifier.wakers.lock().unwrap();

let wakers = match wakers_guard.as_mut() {
let wakers_mut = wakers_guard.as_mut();

let wakers = match wakers_mut {
Some(wakers) => wakers,
None => return,
};
Expand Down
6 changes: 3 additions & 3 deletions futures-util/src/io/write_all_vectored.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ mod tests {
for (mut input, wanted) in tests {
let mut dst = test_writer(2, 2);
{
let mut future = dst.write_all_vectored(&mut *input);
let mut future = dst.write_all_vectored(&mut input);
match Pin::new(&mut future).poll(&mut cx) {
Poll::Ready(Ok(())) => {}
other => panic!("unexpected result polling future: {:?}", other),
}
}
assert_eq!(&*dst.written, &*wanted);
assert_eq!(&*dst.written, wanted);
}
}

Expand All @@ -207,7 +207,7 @@ mod tests {
let data = vec![1, 2, 3, 4];
{
let mut slices = WrapVec(data.chunks(2).map(IoSlice::new).collect());
let mut future = dst.write_all_vectored(&mut *slices.0);
let mut future = dst.write_all_vectored(&mut slices.0);
match Pin::new(&mut future).poll(&mut cx) {
Poll::Ready(Ok(())) => {}
other => panic!("unexpected result polling future: {:?}", other),
Expand Down
5 changes: 4 additions & 1 deletion futures-util/src/lock/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ impl<T: ?Sized> Mutex<T> {
fn remove_waker(&self, wait_key: usize, wake_another: bool) {
if wait_key != WAIT_KEY_NONE {
let mut waiters = self.waiters.lock().unwrap();
match waiters.remove(wait_key) {

let removed_waker = waiters.remove(wait_key);

match removed_waker {
Waiter::Waiting(_) => {}
Waiter::Woken => {
// We were awoken, but then dropped before we could
Expand Down
4 changes: 3 additions & 1 deletion futures/tests/io_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};

type MockReaderFun = Box<dyn FnMut(&mut [u8]) -> Poll<io::Result<usize>>>;

struct MockReader {
fun: Box<dyn FnMut(&mut [u8]) -> Poll<io::Result<usize>>>,
fun: MockReaderFun,
}

impl MockReader {
Expand Down
4 changes: 3 additions & 1 deletion futures/tests/io_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};

type MockWriterFun = Box<dyn FnMut(&[u8]) -> Poll<io::Result<usize>>>;

struct MockWriter {
fun: Box<dyn FnMut(&[u8]) -> Poll<io::Result<usize>>>,
fun: MockWriterFun,
}

impl MockWriter {
Expand Down