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

@@ -3,7 +3,7 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use crate::body::{Payload, Body};
use crate::body::{Body, Payload};
use crate::proto::h2::server::H2Stream;
use crate::server::conn::spawn_all::{NewSvcTask, Watcher};
use crate::service::HttpService;
@@ -22,7 +22,7 @@ pub trait NewSvcExec<I, N, S: HttpService<Body>, E, W: Watcher<I, S, E>>: Clone
fn execute_new_svc(&mut self, fut: NewSvcTask<I, N, S, E, W>);
}
pub type BoxSendFuture = Pin<Box<dyn Future<Output=()> + Send>>;
pub type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
// Either the user provides an executor for background tasks, or we use
// `tokio::spawn`.
@@ -37,7 +37,7 @@ pub enum Exec {
impl Exec {
pub(crate) fn execute<F>(&self, fut: F)
where
F: Future<Output=()> + Send + 'static,
F: Future<Output = ()> + Send + 'static,
{
match *self {
Exec::Default => {
@@ -50,22 +50,20 @@ impl Exec {
// If no runtime, we need an executor!
panic!("executor must be set")
}
},
}
Exec::Executor(ref e) => {
e.execute(Box::pin(fut));
},
}
}
}
}
impl fmt::Debug for Exec {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Exec")
.finish()
f.debug_struct("Exec").finish()
}
}
impl<F, B> H2Exec<F, B> for Exec
where
H2Stream<F, B>: Future<Output = ()> + Send + 'static,
@@ -78,7 +76,7 @@ where
impl<I, N, S, E, W> NewSvcExec<I, N, S, E, W> for Exec
where
NewSvcTask<I, N, S, E, W>: Future<Output=()> + Send + 'static,
NewSvcTask<I, N, S, E, W>: Future<Output = ()> + Send + 'static,
S: HttpService<Body>,
W: Watcher<I, S, E>,
{
@@ -92,7 +90,7 @@ where
impl<E, F, B> H2Exec<F, B> for E
where
E: Executor<H2Stream<F, B>> + Clone,
H2Stream<F, B>: Future<Output=()>,
H2Stream<F, B>: Future<Output = ()>,
B: Payload,
{
fn execute_h2stream(&mut self, fut: H2Stream<F, B>) {
@@ -103,7 +101,7 @@ where
impl<I, N, S, E, W> NewSvcExec<I, N, S, E, W> for E
where
E: Executor<NewSvcTask<I, N, S, E, W>> + Clone,
NewSvcTask<I, N, S, E, W>: Future<Output=()>,
NewSvcTask<I, N, S, E, W>: Future<Output = ()>,
S: HttpService<Body>,
W: Watcher<I, S, E>,
{
@@ -111,4 +109,3 @@ where
self.execute(fut)
}
}