Skip to content

Commit 04f8e84

Browse files
committed
Fix additional clippy warnings
1 parent 42fa77c commit 04f8e84

File tree

10 files changed

+17
-20
lines changed

10 files changed

+17
-20
lines changed

src/future/join_all.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Definition of the JoinAll combinator, waiting for all of a list of futures
1+
//! Definition of the `JoinAll` combinator, waiting for all of a list of futures
22
//! to finish.
33
44
use std::prelude::v1::*;
@@ -94,8 +94,8 @@ impl<I> Future for JoinAll<I>
9494
let mut all_done = true;
9595

9696
for idx in 0 .. self.elems.len() {
97-
let done_val = match &mut self.elems[idx] {
98-
&mut ElemState::Pending(ref mut t) => {
97+
let done_val = match self.elems[idx] {
98+
ElemState::Pending(ref mut t) => {
9999
match t.poll() {
100100
Ok(Async::Ready(v)) => Ok(v),
101101
Ok(Async::NotReady) => {
@@ -105,7 +105,7 @@ impl<I> Future for JoinAll<I>
105105
Err(e) => Err(e),
106106
}
107107
}
108-
&mut ElemState::Done(ref mut _v) => continue,
108+
ElemState::Done(ref mut _v) => continue,
109109
};
110110

111111
match done_val {

src/future/select2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ impl<A, B> Future for Select2<A, B> where A: Future, B: Future {
2323
let (mut a, mut b) = self.inner.take().expect("cannot poll Select2 twice");
2424
match a.poll() {
2525
Err(e) => Err(Either::A((e, b))),
26-
Ok(Async::Ready(x)) => Ok(Async::Ready((Either::A((x, b))))),
26+
Ok(Async::Ready(x)) => Ok(Async::Ready(Either::A((x, b)))),
2727
Ok(Async::NotReady) => match b.poll() {
2828
Err(e) => Err(Either::B((e, a))),
29-
Ok(Async::Ready(x)) => Ok(Async::Ready((Either::B((x, a))))),
29+
Ok(Async::Ready(x)) => Ok(Async::Ready(Either::B((x, a)))),
3030
Ok(Async::NotReady) => {
3131
self.inner = Some((a, b));
3232
Ok(Async::NotReady)

src/future/select_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Definition of the SelectAll, finding the first future in a list that
1+
//! Definition of the `SelectAll`, finding the first future in a list that
22
//! finishes.
33
44
use std::mem;

src/future/shared.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::sync::atomic::Ordering::SeqCst;
2525
use std::collections::HashMap;
2626

2727
/// A future that is cloneable and can be polled in multiple threads.
28-
/// Use Future::shared() method to convert any future into a `Shared` future.
28+
/// Use `Future::shared()` method to convert any future into a `Shared` future.
2929
#[must_use = "futures do nothing unless polled"]
3030
pub struct Shared<F: Future> {
3131
inner: Arc<Inner<F>>,

src/sink/send.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<S: Sink> Future for Send<S> {
4545
if let Some(item) = self.item.take() {
4646
if let AsyncSink::NotReady(item) = try!(self.sink_mut().start_send(item)) {
4747
self.item = Some(item);
48-
return Ok(Async::NotReady)
48+
return Ok(Async::NotReady);
4949
}
5050
}
5151

@@ -54,6 +54,6 @@ impl<S: Sink> Future for Send<S> {
5454
try_ready!(self.sink_mut().poll_complete());
5555

5656
// now everything's emptied, so return the sink for further use
57-
return Ok(Async::Ready(self.take_sink()))
57+
Ok(Async::Ready(self.take_sink()))
5858
}
5959
}

src/sink/send_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<T, U> SendAll<T, U>
4343
.expect("Attempted to poll Forward after completion");
4444
let fuse = self.stream.take()
4545
.expect("Attempted to poll Forward after completion");
46-
return (sink, fuse.into_inner());
46+
(sink, fuse.into_inner())
4747
}
4848

4949
fn try_start_send(&mut self, item: U::Item) -> Poll<(), T::SinkError> {

src/stream/buffered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<S> Stream for Buffered<S>
133133
}
134134

135135
// Next, try and step all the futures forward
136-
for future in self.futures.iter_mut() {
136+
for future in &mut self.futures {
137137
let result = match *future {
138138
State::Running(ref mut s) => {
139139
match s.poll() {

src/stream/forward.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<T, U> Forward<T, U>
4545
.expect("Attempted to poll Forward after completion");
4646
let fuse = self.stream.take()
4747
.expect("Attempted to poll Forward after completion");
48-
return (fuse.into_inner(), sink)
48+
(fuse.into_inner(), sink)
4949
}
5050

5151
fn try_start_send(&mut self, item: T::Item) -> Poll<(), U::SinkError> {

src/stream/select.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ impl<S1, S2> Stream for Select<S1, S2>
5555
if !a_done {
5656
self.flag = !self.flag;
5757
}
58-
return Ok(Some(item).into())
58+
Ok(Some(item).into())
5959
}
6060
Async::Ready(None) if a_done => Ok(None.into()),
61-
Async::Ready(None) => Ok(Async::NotReady),
62-
Async::NotReady => Ok(Async::NotReady),
61+
Async::Ready(None) | Async::NotReady => Ok(Async::NotReady),
6362
}
6463
}
6564
}

src/stream/zip.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,14 @@ impl<S1, S2> Stream for Zip<S1, S2>
3535
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
3636
if self.queued1.is_none() {
3737
match try!(self.stream1.poll()) {
38-
Async::NotReady => {}
3938
Async::Ready(Some(item1)) => self.queued1 = Some(item1),
40-
Async::Ready(None) => {}
39+
Async::Ready(None) | Async::NotReady => {}
4140
}
4241
}
4342
if self.queued2.is_none() {
4443
match try!(self.stream2.poll()) {
45-
Async::NotReady => {}
4644
Async::Ready(Some(item2)) => self.queued2 = Some(item2),
47-
Async::Ready(None) => {}
45+
Async::Ready(None) | Async::NotReady => {}
4846
}
4947
}
5048

0 commit comments

Comments
 (0)