cleanup after tokio upgrade (#3571)

tokio_util::run and tokio::run_on_current_thread should accept Future<Output=()> instead of Future<Output=Result<(), ()>>. Currently, all the passed futures have to add Ok(()) or futures::future::ok(()) unnecessarily to call this method.
This commit is contained in:
Gurwinder Singh 2020-01-01 20:21:27 +05:30 committed by Ry Dahl
parent 4258ed262f
commit 55add2d366
6 changed files with 29 additions and 57 deletions

View file

@ -5,7 +5,7 @@ use tokio::runtime;
pub fn run<F>(future: F)
where
F: Future<Output = Result<(), ()>> + Send + 'static,
F: Future<Output = ()> + Send + 'static,
{
let mut rt = runtime::Builder::new()
.threaded_scheduler()
@ -13,12 +13,12 @@ where
.thread_name("deno")
.build()
.expect("Unable to create Tokio runtime");
rt.block_on(future).unwrap();
rt.block_on(future);
}
pub fn run_on_current_thread<F>(future: F)
where
F: Future<Output = Result<(), ()>> + Send + 'static,
F: Future<Output = ()> + Send + 'static,
{
let mut rt = runtime::Builder::new()
.basic_scheduler()
@ -26,5 +26,5 @@ where
.thread_name("deno")
.build()
.expect("Unable to create Tokio runtime");
rt.block_on(future).unwrap();
rt.block_on(future);
}