mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
chore: format code and enable rustfmt CI task (#1212)
This commit is contained in:
@@ -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.
|
||||
///
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user