From d994f5452a4551576c89c1080831b03dc23083a0 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 26 Oct 2023 09:55:19 +0900 Subject: [PATCH] m: Remove dependency on waker-fn --- Cargo.toml | 6 +++--- src/future.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f127b75..690bf1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ exclude = ["/.*"] [features] default = ["race", "std"] -std = ["alloc", "fastrand/std", "futures-io", "parking", "memchr", "waker-fn"] +std = ["alloc", "fastrand/std", "futures-io", "parking", "memchr"] alloc = [] race = ["fastrand"] @@ -30,9 +30,9 @@ fastrand = { version = "2.0.0", optional = true, default-features = false } futures-core = { version = "0.3.5", default-features = false } futures-io = { version = "0.3.5", optional = true } memchr = { version = "2.3.3", optional = true } -parking = { version = "2.0.0", optional = true } +parking = { version = "2.2.0", optional = true } pin-project-lite = "0.2.0" -waker-fn = { version = "1.0.0", optional = true } [dev-dependencies] spin_on = "0.1.0" +waker-fn = "1.0.0" # used in doctests diff --git a/src/future.rs b/src/future.rs index 2948185..d7f4cc7 100644 --- a/src/future.rs +++ b/src/future.rs @@ -58,7 +58,6 @@ pub fn block_on(future: impl Future) -> T { use core::task::Waker; use parking::Parker; - use waker_fn::waker_fn; // Pin the future on the stack. crate::pin!(future); @@ -67,9 +66,7 @@ pub fn block_on(future: impl Future) -> T { fn parker_and_waker() -> (Parker, Waker) { let parker = Parker::new(); let unparker = parker.unparker(); - let waker = waker_fn(move || { - unparker.unpark(); - }); + let waker = Waker::from(unparker); (parker, waker) }