From 6a1d2549319b46f84e5318f6ee1f99affb3da167 Mon Sep 17 00:00:00 2001 From: wireless4024 Date: Sun, 12 Feb 2023 11:18:50 +0700 Subject: [PATCH] reverse out-of-scope change --- actix-rt/examples/hyper.rs | 14 ++++---------- actix-rt/examples/multi_thread_system.rs | 13 +++---------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/actix-rt/examples/hyper.rs b/actix-rt/examples/hyper.rs index 3134f413..52e0da30 100644 --- a/actix-rt/examples/hyper.rs +++ b/actix-rt/examples/hyper.rs @@ -10,20 +10,14 @@ async fn handle(_req: Request) -> Result, Infallible> { } fn main() { - #[cfg(not(feature = "io-uring"))] - let rt = actix_rt::System::with_tokio_rt(|| { + actix_rt::System::with_tokio_rt(|| { tokio::runtime::Builder::new_multi_thread() .enable_all() .build() .unwrap() - }); - #[cfg(feature = "io-uring")] - let rt = actix_rt::System::with_tokio_rt(|| { - tokio_uring::Runtime::new(&tokio_uring::builder()) - .unwrap() - }); - - rt.block_on(async { + // for io_uring feature use `tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()` + }) + .block_on(async { let make_service = make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) }); diff --git a/actix-rt/examples/multi_thread_system.rs b/actix-rt/examples/multi_thread_system.rs index 9e2c5db5..0ecd1ef1 100644 --- a/actix-rt/examples/multi_thread_system.rs +++ b/actix-rt/examples/multi_thread_system.rs @@ -4,22 +4,15 @@ use actix_rt::System; fn main() { - #[cfg(not(feature = "io-uring"))] - let system = System::with_tokio_rt(|| { + System::with_tokio_rt(|| { // build system with a multi-thread tokio runtime. tokio::runtime::Builder::new_multi_thread() .worker_threads(2) .enable_all() .build() .unwrap() - }); - #[cfg(feature = "io-uring")] - let system = System::with_tokio_rt(|| { - // build system with tokio uring runtime. - tokio_uring::Runtime::new(&tokio_uring::builder()) - .unwrap() - }); - system.block_on(async_main()); + }) + .block_on(async_main()); } // async main function that acts like #[actix_web::main] or #[tokio::main]