chore: apply rustfmt to all crates (#917)

This commit is contained in:
Carl Lerche
2019-02-21 11:56:15 -08:00
committed by GitHub
parent ab595d0825
commit 80162306e7
253 changed files with 3710 additions and 3407 deletions
+7 -3
View File
@@ -1,4 +1,4 @@
use futures::{Async, Poll, Stream, Sink, StartSend};
use futures::{Async, Poll, Sink, StartSend, Stream};
/// A stream combinator which combines the yields the current item
/// plus its count starting from 0.
@@ -13,7 +13,10 @@ pub struct Enumerate<T> {
impl<T> Enumerate<T> {
pub(crate) fn new(stream: T) -> Self {
Self { inner: stream, count: 0 }
Self {
inner: stream,
count: 0,
}
}
/// Acquires a reference to the underlying stream that this combinator is
@@ -61,7 +64,8 @@ where
// Forwarding impl of Sink from the underlying stream
impl<T> Sink for Enumerate<T>
where T: Sink
where
T: Sink,
{
type SinkItem = T::SinkItem;
type SinkError = T::SinkError;
+5 -5
View File
@@ -7,8 +7,7 @@ use tokio_timer::Timeout;
use futures::Future;
#[cfg(feature = "timer")]
use std::time::{Instant, Duration};
use std::time::{Duration, Instant};
/// An extension trait for `Future` that provides a variety of convenient
/// combinator functions.
@@ -24,7 +23,6 @@ use std::time::{Instant, Duration};
///
/// [`timeout`]: #method.timeout
pub trait FutureExt: Future {
/// Creates a new future which allows `self` until `timeout`.
///
/// This combinator creates a new future which wraps the receiving future
@@ -60,7 +58,8 @@ pub trait FutureExt: Future {
/// ```
#[cfg(feature = "timer")]
fn timeout(self, timeout: Duration) -> Timeout<Self>
where Self: Sized,
where
Self: Sized,
{
Timeout::new(self, timeout)
}
@@ -70,7 +69,8 @@ pub trait FutureExt: Future {
#[allow(deprecated)]
#[doc(hidden)]
fn deadline(self, deadline: Instant) -> Deadline<Self>
where Self: Sized,
where
Self: Sized,
{
Deadline::new(self, deadline)
}
+1 -1
View File
@@ -7,9 +7,9 @@
//! [`FutureExt`]: trait.FutureExt.html
//! [`StreamExt`]: trait.StreamExt.html
mod enumerate;
mod future;
mod stream;
mod enumerate;
pub use self::future::FutureExt;
pub use self::stream::StreamExt;
+7 -7
View File
@@ -1,8 +1,5 @@
#[cfg(feature = "timer")]
use tokio_timer::{
throttle::Throttle,
Timeout,
};
use tokio_timer::{throttle::Throttle, Timeout};
use futures::Stream;
@@ -29,7 +26,8 @@ pub trait StreamExt: Stream {
/// Errors are also delayed.
#[cfg(feature = "timer")]
fn throttle(self, duration: Duration) -> Throttle<Self>
where Self: Sized
where
Self: Sized,
{
Throttle::new(self, duration)
}
@@ -47,7 +45,8 @@ pub trait StreamExt: Stream {
/// an iterator with more than [`std::usize::MAX`] elements either produces the
/// wrong result or panics.
fn enumerate(self) -> Enumerate<Self>
where Self: Sized,
where
Self: Sized,
{
Enumerate::new(self)
}
@@ -86,7 +85,8 @@ pub trait StreamExt: Stream {
/// ```
#[cfg(feature = "timer")]
fn timeout(self, timeout: Duration) -> Timeout<Self>
where Self: Sized,
where
Self: Sized,
{
Timeout::new(self, timeout)
}