Update Tokio to Rust 2018 (#1082)

This commit is contained in:
Carl Lerche
2019-05-14 10:27:36 -07:00
committed by GitHub
parent 79d8820050
commit cb4aea394e
343 changed files with 1725 additions and 2813 deletions
+4 -6
View File
@@ -1,8 +1,6 @@
use pool::Pool;
use task::{BlockingState, Task};
use crate::pool::Pool;
use crate::task::{BlockingState, Task};
use futures::{Async, Poll};
use std::cell::UnsafeCell;
use std::fmt;
use std::ptr;
@@ -111,7 +109,7 @@ impl Blocking {
///
/// The caller must ensure that `task` has not previously been queued to be
/// notified when capacity becomes available.
pub fn poll_blocking_capacity(&self, task: &Arc<Task>) -> Poll<(), ::BlockingError> {
pub fn poll_blocking_capacity(&self, task: &Arc<Task>) -> Poll<(), crate::BlockingError> {
// This requires atomically claiming blocking capacity and if none is
// available, queuing &task.
@@ -482,7 +480,7 @@ impl From<State> for usize {
}
impl fmt::Debug for State {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut fmt = fmt.debug_struct("State");
if self.is_ptr() {
+2 -3
View File
@@ -1,5 +1,4 @@
use task::CanBlock;
use crate::task::CanBlock;
use std::fmt;
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -80,7 +79,7 @@ impl From<BlockingState> for usize {
}
impl fmt::Debug for BlockingState {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("BlockingState")
.field("is_queued", &self.is_queued())
.field("is_allocated", &self.is_allocated())
+5 -7
View File
@@ -5,13 +5,11 @@ mod state;
pub(crate) use self::blocking::{Blocking, CanBlock};
use self::blocking_state::BlockingState;
use self::state::State;
use notifier::Notifier;
use pool::Pool;
use crate::notifier::Notifier;
use crate::pool::Pool;
use futures::executor::{self, Spawn};
use futures::{self, Async, Future};
use log::trace;
use std::cell::{Cell, UnsafeCell};
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
use std::sync::atomic::{AtomicPtr, AtomicUsize};
@@ -60,7 +58,7 @@ pub(crate) enum Run {
Complete,
}
type BoxFuture = Box<Future<Item = (), Error = ()> + Send + 'static>;
type BoxFuture = Box<dyn Future<Item = (), Error = ()> + Send + 'static>;
// ===== impl Task =====
@@ -299,7 +297,7 @@ impl Task {
}
impl fmt::Debug for Task {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Task")
.field("state", &self.state)
.field("future", &"Spawn<BoxFuture>")