process: Misc polish (#1400)

* Denied all warnings in tests, and denied rust_2018_idioms violations
* Bumped the crate version and set publish = false
* Pruned dependencies:
 - Only pull in tokio-sync on windows where it is used
 - Removed unused dev-dependencies
* Switch to Async{Read, Write} traits from tokio-io rather than
futures-io
* Use #[tokio::test] where possible
* Removed deprecated items
* Fix all doc examples
This commit is contained in:
Ivan Petkov
2019-08-07 10:38:45 -07:00
committed by Carl Lerche
parent 47e2ff48d9
commit cb2336ff3d
10 changed files with 199 additions and 268 deletions
+1 -14
View File
@@ -1,4 +1,4 @@
extern crate tokio;
#![deny(warnings, rust_2018_idioms)]
use futures_util::future;
use futures_util::future::FutureExt;
@@ -8,8 +8,6 @@ use std::process::Command;
use std::time::Duration;
use tokio::timer::Timeout;
pub use self::tokio::runtime::current_thread::Runtime as CurrentThreadRuntime;
#[allow(dead_code)]
pub fn cmd(s: &str) -> Command {
let mut me = env::current_exe().unwrap();
@@ -29,14 +27,3 @@ pub fn with_timeout<F: Future>(future: F) -> impl Future<Output = F::Output> {
future::ready(r.unwrap())
})
}
pub fn run_with_timeout<F>(future: F) -> F::Output
where
F: Future,
{
// NB: Timeout requires a timer registration which is provided by
// tokio's `current_thread::Runtime`, but isn't available by just using
// tokio's default CurrentThread executor which powers `current_thread::block_on_all`.
let mut rt = CurrentThreadRuntime::new().expect("failed to get runtime");
rt.block_on(with_timeout(future))
}