Skip to content

Commit 523d66a

Browse files
authored
refactor(body): fix unused sync_wrapper when stream feature disabled (#2287)
1 parent aea9c52 commit 523d66a

File tree

7 files changed

+46
-4
lines changed

7 files changed

+46
-4
lines changed

Diff for: .github/workflows/CI.yml

+29-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ jobs:
5454
- rust: nightly
5555
features: "--features nightly"
5656
benches: true
57-
# Limit the Happy Eyeballs tests to Linux
58-
- rust: stable
59-
os: ubuntu-latest
60-
features: "--features __internal_happy_eyeballs_tests"
6157

6258
runs-on: ${{ matrix.os }}
6359

@@ -85,6 +81,35 @@ jobs:
8581
command: test
8682
args: --benches ${{ matrix.features }}
8783

84+
features:
85+
name: Test Feature ${{ matrix.features }}
86+
needs: [style]
87+
strategy:
88+
matrix:
89+
features:
90+
- "--features __internal_happy_eyeballs_tests"
91+
- "--no-default-features --features tcp"
92+
- "--no-default-features"
93+
94+
runs-on: ubuntu-latest
95+
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@v1
99+
100+
- name: Install Rust
101+
uses: actions-rs/toolchain@v1
102+
with:
103+
profile: minimal
104+
toolchain: stable
105+
override: true
106+
107+
- name: Test
108+
uses: actions-rs/cargo@v1
109+
with:
110+
command: test
111+
args: ${{ matrix.features }}
112+
88113
doc:
89114
name: Build docs
90115
needs: [style, test]

Diff for: Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ name = "send_file"
137137
path = "examples/send_file.rs"
138138
required-features = ["runtime"]
139139

140+
[[example]]
141+
name = "service_struct_impl"
142+
path = "examples/service_struct_impl.rs"
143+
required-features = ["runtime"]
144+
140145
[[example]]
141146
name = "single_threaded"
142147
path = "examples/single_threaded.rs"

Diff for: src/body/body.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use futures_util::TryStreamExt;
1111
use http::HeaderMap;
1212
use http_body::{Body as HttpBody, SizeHint};
1313

14+
#[cfg(feature = "stream")]
1415
use crate::common::sync_wrapper::SyncWrapper;
1516
use crate::common::{task, watch, Future, Never, Pin, Poll};
1617
use crate::proto::h2::ping;

Diff for: src/client/connect/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
//! Or, fully written out:
2727
//!
2828
//! ```
29+
//! # #[cfg(feature = "runtime")]
30+
//! # mod rt {
2931
//! use std::{future::Future, net::SocketAddr, pin::Pin, task::{self, Poll}};
3032
//! use hyper::{service::Service, Uri};
3133
//! use tokio::net::TcpStream;
@@ -50,6 +52,7 @@
5052
//! Box::pin(TcpStream::connect(SocketAddr::from(([127, 0, 0, 1], 1337))))
5153
//! }
5254
//! }
55+
//! # }
5356
//! ```
5457
//!
5558
//! It's worth noting that for `TcpStream`s, the [`HttpConnector`][] is a
@@ -59,11 +62,14 @@
5962
//! `Client` like this:
6063
//!
6164
//! ```
65+
//! # #[cfg(feature = "runtime")]
66+
//! # fn rt () {
6267
//! # let connector = hyper::client::HttpConnector::new();
6368
//! // let connector = ...
6469
//!
6570
//! let client = hyper::Client::builder()
6671
//! .build::<_, hyper::Body>(connector);
72+
//! # }
6773
//! ```
6874
//!
6975
//!

Diff for: src/client/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub(crate) mod dispatch;
7373
mod pool;
7474
pub mod service;
7575
#[cfg(test)]
76+
#[cfg(feature = "runtime")]
7677
mod tests;
7778

7879
/// A Client to make outgoing HTTP requests.

Diff for: src/common/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub(crate) mod exec;
1313
pub(crate) mod io;
1414
mod lazy;
1515
mod never;
16+
#[cfg(feature = "stream")]
1617
pub(crate) mod sync_wrapper;
1718
pub(crate) mod task;
1819
pub(crate) mod watch;

Diff for: src/server/conn.rs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//! ## Example
1212
//! A simple example that uses the `Http` struct to talk HTTP over a Tokio TCP stream
1313
//! ```no_run
14+
//! # #[cfg(feature = "runtime")]
15+
//! # mod rt {
1416
//! use http::{Request, Response, StatusCode};
1517
//! use hyper::{server::conn::Http, service::service_fn, Body};
1618
//! use std::{net::SocketAddr, convert::Infallible};
@@ -38,6 +40,7 @@
3840
//! async fn hello(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
3941
//! Ok(Response::new(Body::from("Hello World!")))
4042
//! }
43+
//! # }
4144
//! ```
4245
4346
use std::error::Error as StdError;

0 commit comments

Comments
 (0)