Skip to content

Commit b0cc9cd

Browse files
authored
build(deps): remove redundant atomic-waker dependency (#776)
1 parent b089c6e commit b0cc9cd

7 files changed

Lines changed: 14 additions & 72 deletions

File tree

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ url = "2.5"
6969
serde = { version = "1.0", features = ["derive"] }
7070
serde_urlencoded = "0.7.1"
7171
tower = { version = "0.5.2", default-features = false, features = ["timeout", "util", "retry"] }
72-
tower-http = { version = "0.6.6", default-features = false, optional = true }
7372
tower-service = "0.3"
7473
sync_wrapper = { version = "1.0", features = ["futures"] }
7574

@@ -78,15 +77,13 @@ bytes = "1.2"
7877
http = "1"
7978
http-body = "1"
8079
tokio = { version = "1", default-features = false, features = ["net","time","rt"] }
81-
atomic-waker = "1.1.2"
8280
futures-channel = "0.3.31"
8381
futures-util = { version = "0.3.31", default-features = false }
8482
http2 = { version = "0.5.4", features = ["unstable"]}
8583
http-body-util = "0.1"
8684
httparse = "1.9"
8785
pin-project-lite = "0.2.4"
8886
smallvec = { version = "1.12", features = ["const_generics", "const_new"] }
89-
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
9087
want = "0.3"
9188
socket2 = { version = "0.5.10", features = ["all"] }
9289
percent-encoding = "2.3"
@@ -120,6 +117,9 @@ webpki-root-certs = { version = "1.0.0", optional = true }
120117
cookie_crate = { version = "0.18", package = "cookie", optional = true }
121118
cookie_store = { version = "0.21", features = ["preserve_order"], optional = true }
122119

120+
## tower http
121+
tower-http = { version = "0.6.6", default-features = false, optional = true }
122+
123123
## tokio util
124124
tokio-util = { version = "0.7.15", default-features = false, features = ["codec","io"], optional = true }
125125

@@ -132,6 +132,9 @@ tokio-tungstenite = { version = "0.27.0", default-features = false, features = [
132132
## hickory-dns
133133
hickory-resolver = { version = "0.25.2", optional = true }
134134

135+
## tracing
136+
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
137+
135138
## windows system proxy
136139
[target.'cfg(windows)'.dependencies]
137140
windows-registry = { version = "0.5.2", optional = true }
@@ -140,7 +143,7 @@ windows-registry = { version = "0.5.2", optional = true }
140143
[target.'cfg(target_os = "macos")'.dependencies]
141144
system-configuration = { version = "0.6.1", optional = true }
142145

143-
## Interface binding
146+
## interface binding
144147
[target.'cfg(any(target_os = "ios", target_os = "visionos", target_os = "macos", target_os = "tvos", target_os = "watchos", target = "illumos", target = "solaris"))'.dependencies]
145148
libc = "0.2.173"
146149

src/core/client/dispatch.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ impl<T, U> Receiver<T, U> {
161161
}
162162

163163
pub(crate) fn try_recv(&mut self) -> Option<(T, Callback<T, U>)> {
164-
match crate::core::common::task::now_or_never(self.inner.recv()) {
164+
use futures_util::FutureExt;
165+
match self.inner.recv().now_or_never() {
165166
Some(Some(mut env)) => env.0.take(),
166167
_ => None,
167168
}

src/core/common/either.rs

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/core/common/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pub(crate) mod buf;
2-
pub(crate) mod either;
32
pub(crate) mod io;
43
pub(crate) mod task;
54
pub(crate) mod time;

src/core/common/task.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,3 @@ pub(crate) fn yield_now(cx: &mut Context<'_>) -> Poll<std::convert::Infallible>
77
cx.waker().wake_by_ref();
88
Poll::Pending
99
}
10-
11-
/// Poll the future once and return `Some` if it is ready, else `None`.
12-
///
13-
/// If the future wasn't ready, the future likely can't be driven to completion any more: the
14-
/// polling uses a no-op waker, so knowledge of what the pending future was waiting for is lost.
15-
pub(crate) fn now_or_never<F: std::future::Future>(fut: F) -> Option<F::Output> {
16-
let waker = std::task::Waker::noop();
17-
let mut cx = Context::from_waker(waker);
18-
let fut = std::pin::pin!(fut);
19-
match fut.poll(&mut cx) {
20-
Poll::Ready(res) => Some(res),
21-
Poll::Pending => None,
22-
}
23-
}

src/core/common/watch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212
task,
1313
};
1414

15-
use atomic_waker::AtomicWaker;
15+
use futures_util::task::AtomicWaker;
1616

1717
type Value = usize;
1818

src/core/proto/h2/client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use futures_channel::{
1414
oneshot,
1515
};
1616
use futures_util::{
17-
future::FusedFuture,
17+
future::{Either, FusedFuture},
1818
stream::{FusedStream, Stream},
1919
};
2020
use http::{Method, Request, Response, StatusCode};
@@ -33,7 +33,7 @@ use super::{
3333
use crate::core::{
3434
body::Incoming as IncomingBody,
3535
client::dispatch::{self, Callback, SendWhen, TrySendError},
36-
common::{either::Either, io::Compat, time::Time},
36+
common::{io::Compat, time::Time},
3737
error::BoxError,
3838
ext::{Protocol, RequestConfig, RequestOriginalHeaders},
3939
proto::{Dispatched, h2::UpgradedSendStream, headers},
@@ -225,9 +225,9 @@ where
225225
let (recorder, ponger) = ping::channel(pp, ping_config, timer);
226226

227227
let conn: Conn<_, B> = Conn::new(ponger, conn);
228-
(Either::left(conn), recorder)
228+
(Either::Left(conn), recorder)
229229
} else {
230-
(Either::right(conn), ping::disabled())
230+
(Either::Right(conn), ping::disabled())
231231
};
232232
let conn: ConnMapErr<T, B> = ConnMapErr {
233233
conn,

0 commit comments

Comments
 (0)