Skip to content

Commit 9b306af

Browse files
committed
Fix unused dependencies and tls configuration in connector.rs
1 parent 3c013ea commit 9b306af

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

examples/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ grpc-web = [
302302
"dep:bytes",
303303
"dep:http",
304304
"dep:hyper",
305+
"dep:hyper-util",
305306
"dep:tracing-subscriber",
306307
"dep:tower",
307308
]
@@ -315,15 +316,16 @@ tracing = ["dep:tracing", "dep:tracing-subscriber"]
315316
# "dep:warp",
316317
# ]
317318
# hyper-warp-multiplex = ["hyper-warp"]
318-
uds = ["tokio-stream/net", "dep:tower", "dep:hyper"]
319+
uds = ["tokio-stream/net", "dep:tower", "dep:hyper", "dep:hyper-util"]
319320
streaming = ["tokio-stream", "dep:h2"]
320321
mock = ["tokio-stream", "dep:tower", "dep:hyper-util"]
321-
tower = ["dep:hyper", "dep:tower", "dep:http"]
322+
tower = ["dep:hyper", "dep:hyper-util", "dep:tower", "dep:http"]
322323
json-codec = ["dep:serde", "dep:serde_json", "dep:bytes"]
323324
compression = ["tonic/gzip"]
324325
tls = ["tonic/tls"]
325326
tls-rustls = [
326327
"dep:hyper",
328+
"dep:hyper-util",
327329
"dep:hyper-rustls",
328330
"dep:tower",
329331
"tower-http/util",

tonic/src/transport/service/connector.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#[cfg(feature = "tls")]
12
use std::fmt;
3+
24
use std::task::{Context, Poll};
35

46
use http::Uri;
@@ -102,14 +104,17 @@ where
102104
}
103105

104106
/// Error returned when trying to connect to an HTTPS endpoint without TLS enabled.
107+
#[cfg(feature = "tls")]
105108
#[derive(Debug)]
106109
pub(crate) struct HttpsUriWithoutTlsSupport(());
107110

111+
#[cfg(feature = "tls")]
108112
impl fmt::Display for HttpsUriWithoutTlsSupport {
109113
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
110114
write!(f, "Connecting to HTTPS without TLS enabled")
111115
}
112116
}
113117

114118
// std::error::Error only requires a type to impl Debug and Display
119+
#[cfg(feature = "tls")]
115120
impl std::error::Error for HttpsUriWithoutTlsSupport {}

0 commit comments

Comments
 (0)