Skip to content

Commit

Permalink
m: Remove dependency on waker-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Oct 26, 2023
1 parent c8551a3 commit d994f54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -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
5 changes: 1 addition & 4 deletions src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub fn block_on<T>(future: impl Future<Output = T>) -> T {
use core::task::Waker;

use parking::Parker;
use waker_fn::waker_fn;

// Pin the future on the stack.
crate::pin!(future);
Expand All @@ -67,9 +66,7 @@ pub fn block_on<T>(future: impl Future<Output = T>) -> 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)
}

Expand Down

0 comments on commit d994f54

Please sign in to comment.