style(lib): run rustfmt and enforce in CI

This commit is contained in:
Sean McArthur
2019-12-05 13:30:53 -08:00
parent b0060f277e
commit 0dc89680cd
69 changed files with 2982 additions and 2499 deletions

View File

@@ -9,7 +9,10 @@
#[cfg(feature = "stream")]
use futures_core::Stream;
use crate::common::{Pin, task::{self, Poll}};
use crate::common::{
task::{self, Poll},
Pin,
};
/// Asynchronously accept incoming connections.
pub trait Accept {
@@ -19,8 +22,10 @@ pub trait Accept {
type Error;
/// Poll to accept the next connection.
fn poll_accept(self: Pin<&mut Self>, cx: &mut task::Context<'_>)
-> Poll<Option<Result<Self::Conn, Self::Error>>>;
fn poll_accept(
self: Pin<&mut Self>,
cx: &mut task::Context<'_>,
) -> Poll<Option<Result<Self::Conn, Self::Error>>>;
}
/// Create an `Accept` with a polling function.
@@ -54,12 +59,11 @@ where
{
type Conn = IO;
type Error = E;
fn poll_accept(self: Pin<&mut Self>, cx: &mut task::Context<'_>)
-> Poll<Option<Result<Self::Conn, Self::Error>>>
{
unsafe {
(self.get_unchecked_mut().0)(cx)
}
fn poll_accept(
self: Pin<&mut Self>,
cx: &mut task::Context<'_>,
) -> Poll<Option<Result<Self::Conn, Self::Error>>> {
unsafe { (self.get_unchecked_mut().0)(cx) }
}
}
@@ -85,13 +89,11 @@ where
{
type Conn = IO;
type Error = E;
fn poll_accept(self: Pin<&mut Self>, cx: &mut task::Context<'_>)
-> Poll<Option<Result<Self::Conn, Self::Error>>>
{
unsafe {
Pin::new_unchecked(&mut self.get_unchecked_mut().0)
.poll_next(cx)
}
fn poll_accept(
self: Pin<&mut Self>,
cx: &mut task::Context<'_>,
) -> Poll<Option<Result<Self::Conn, Self::Error>>> {
unsafe { Pin::new_unchecked(&mut self.get_unchecked_mut().0).poll_next(cx) }
}
}