chore: format code and enable rustfmt CI task (#1212)

This commit is contained in:
Carl Lerche
2019-06-27 00:05:01 -07:00
committed by GitHub
parent 1f47ed3dcc
commit ed4d4a5353
22 changed files with 94 additions and 60 deletions
+1 -1
View File
@@ -1,8 +1,8 @@
use crate::timer::{HandlePriv, Registration};
use std::future::Future;
use std::pin::Pin;
use std::time::{Duration, Instant};
use std::task::{self, Poll};
use std::time::{Duration, Instant};
/// A future that completes at a specified instant in time.
///
+2 -2
View File
@@ -32,12 +32,12 @@
//! [`Timer`]: timer/struct.Timer.html
macro_rules! ready {
($e:expr) => (
($e:expr) => {
match $e {
::std::task::Poll::Ready(v) => v,
::std::task::Poll::Pending => return ::std::task::Poll::Pending,
}
)
};
}
pub mod clock;
+4 -1
View File
@@ -67,7 +67,10 @@ impl<T: Stream> Stream for Throttle<T> {
self.as_mut().get_unchecked_mut().has_delayed = true;
}
let value = ready!(self.as_mut().map_unchecked_mut(|me| &mut me.stream).poll_next(cx));
let value = ready!(self
.as_mut()
.map_unchecked_mut(|me| &mut me.stream)
.poll_next(cx));
if value.is_some() {
self.as_mut().get_unchecked_mut().delay.reset_timeout();
+1 -2
View File
@@ -72,7 +72,6 @@ pub struct Timeout<T> {
delay: Delay,
}
/// Error returned by `Timeout`.
#[derive(Debug)]
pub struct Elapsed(());
@@ -170,7 +169,7 @@ where
unsafe {
match self.map_unchecked_mut(|me| &mut me.delay).poll(cx) {
Poll::Ready(()) => Poll::Ready(Err(Elapsed(()))),
Poll::Pending => Poll::Pending
Poll::Pending => Poll::Pending,
}
}
}
-1
View File
@@ -290,7 +290,6 @@ impl Entry {
}
pub fn poll_elapsed(&self, cx: &mut task::Context<'_>) -> Poll<Result<(), Error>> {
let mut curr = self.state.load(SeqCst);
if is_elapsed(curr) {
+1 -1
View File
@@ -3,7 +3,7 @@ use crate::{Delay, Error, /*Interval,*/ Timeout};
use std::cell::RefCell;
use std::fmt;
use std::sync::{Arc, Weak};
use std::time::{/*Duration,*/ Instant};
use std::time::Instant;
use tokio_executor::Enter;
/// Handle to timer instance.