Skip to content

Commit 6b3d2e8

Browse files
ensure that tests work when only server-auto feature is enabled (#271)
These two commands: cargo test --no-default-features --features server-auto --features tokio cargo test --no-default-features --features server-auto
1 parent 4595a08 commit 6b3d2e8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ hyper = { version = "1.4.0", features = ["full"] }
4040
bytes = "1"
4141
futures-util = { version = "0.3.16", default-features = false, features = ["alloc"] }
4242
http-body-util = "0.1.0"
43-
tokio = { version = "1", features = ["macros", "test-util", "signal"] }
43+
tokio = { version = "1", features = ["macros", "test-util", "signal", "net"] }
4444
tokio-test = "0.4"
4545
tower-test = "0.4"
4646
pretty_env_logger = "0.5"

src/server/conn/auto/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,15 @@ impl<E> Builder<E> {
8080
/// # Example
8181
///
8282
/// ```
83+
/// # #[cfg(feature = "tokio")]
84+
/// # {
8385
/// use hyper_util::{
8486
/// rt::TokioExecutor,
8587
/// server::conn::auto,
8688
/// };
8789
///
8890
/// auto::Builder::new(TokioExecutor::new());
91+
/// # }
8992
/// ```
9093
pub fn new(executor: E) -> Self {
9194
Self {
@@ -171,13 +174,16 @@ impl<E> Builder<E> {
171174
/// # Example
172175
///
173176
/// ```
177+
/// # #[cfg(feature = "tokio")]
178+
/// # {
174179
/// use hyper_util::{
175180
/// rt::TokioExecutor,
176181
/// server::conn::auto,
177182
/// };
178183
///
179184
/// auto::Builder::new(TokioExecutor::new())
180185
/// .title_case_headers(true);
186+
/// # }
181187
/// ```
182188
#[cfg(feature = "http1")]
183189
pub fn title_case_headers(mut self, enabled: bool) -> Self {
@@ -195,13 +201,16 @@ impl<E> Builder<E> {
195201
/// # Example
196202
///
197203
/// ```
204+
/// # #[cfg(feature = "tokio")]
205+
/// # {
198206
/// use hyper_util::{
199207
/// rt::TokioExecutor,
200208
/// server::conn::auto,
201209
/// };
202210
///
203211
/// auto::Builder::new(TokioExecutor::new())
204212
/// .preserve_header_case(true);
213+
/// # }
205214
/// ```
206215
#[cfg(feature = "http1")]
207216
pub fn preserve_header_case(mut self, enabled: bool) -> Self {
@@ -1124,7 +1133,7 @@ impl<E> Http2Builder<'_, E> {
11241133
}
11251134
}
11261135

1127-
#[cfg(test)]
1136+
#[cfg(all(feature = "tokio", test))]
11281137
mod tests {
11291138
use crate::{
11301139
rt::{TokioExecutor, TokioIo},

0 commit comments

Comments
 (0)