Address some reviewing (#1246)

This commit is contained in:
Pierre Krieger 2019-09-20 10:46:13 +02:00 committed by GitHub
parent 170d2d268f
commit c7148d5ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View File

@ -177,7 +177,7 @@ impl<I, O, H, E, HE, T, C> Manager<I, O, H, E, HE, T, C> {
let task = Box::pin(Task::new(task_id, self.events_tx.clone(), rx, future, handler));
if let Some(threads_pool) = &mut self.threads_pool {
threads_pool.spawn(task).expect("spawning a task on a threads pool never fails; qed");
threads_pool.spawn(task).expect("spawning a task on a thread pool never fails; qed");
} else {
self.local_spawns.push(task);
}
@ -209,10 +209,6 @@ impl<I, O, H, E, HE, T, C> Manager<I, O, H, E, HE, T, C> {
let (tx, rx) = mpsc::channel(4);
self.tasks.insert(task_id, TaskInfo { sender: tx, user_data });
// TODO: we use `Pin<Box<Pending>>` instead of just `Pending` because `Pending` doesn't
// implement `Unpin` even though it should ; this is just a dummy template parameter and
// the `Box` is never actually created, so this has no repercusion whatsoever
// see https://github.com/rust-lang-nursery/futures-rs/pull/1746
let task: Task<Pin<Box<futures::future::Pending<_>>>, _, _, _, _, _, _> =
Task::node(task_id, self.events_tx.clone(), rx, HandledNode::new(muxer, handler));

View File

@ -249,7 +249,7 @@ impl ArcWake for Notifier {
/// Processes elements in `inner` until one matching `filter` is found.
///
/// If `Pending` is returned, the waker is kept and notifier later, just like with any `Poll`.
/// If `Pending` is returned, the waker is kept and notified later, just like with any `Poll`.
/// `Ready(Ok())` is almost always returned. An error is returned if the stream is EOF.
fn next_match<C, F, O>(inner: &mut MultiplexInner<C>, cx: &mut Context, mut filter: F) -> Poll<Result<O, IoError>>
where C: AsyncRead + AsyncWrite + Unpin,

View File

@ -343,7 +343,8 @@ where TBehaviour: NetworkBehaviour<ProtocolsHandler = THandler>,
type Item = Result<TBehaviour::OutEvent, io::Error>;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
// We use a `this` variable to solve borrowing issues.
// We use a `this` variable because the compiler can't mutably borrow multiple times
// across a `Deref`.
let this = &mut *self;
loop {