Skip to content

Commit 9c6a5f0

Browse files
authored
Merge pull request #86 from hatoo/optional-default-client
Optional default client
2 parents b45e2d8 + 37967b0 commit 9c6a5f0

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
- uses: Swatinem/rust-cache@v2
2121
- name: Build
2222
run: cargo build --verbose
23+
- name: Build
24+
run: cargo build --verbose --no-default-features
2325
- name: Run tests
2426
run: cargo test --verbose
2527
- name: Run tests --no-default-features --features rustls-client

src/default_client.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(any(feature = "native-tls-client", feature = "rustls-client"))]
2+
13
use bytes::Bytes;
24
use http_body_util::Empty;
35
use hyper::{
@@ -14,9 +16,6 @@ compile_error!(
1416
"feature \"native-tls-client\" and feature \"rustls-client\" cannot be enabled at the same time"
1517
);
1618

17-
#[cfg(all(not(feature = "native-tls-client"), not(feature = "rustls-client")))]
18-
compile_error!("feature \"native-tls-client\" or feature \"rustls-client\" must be enabled");
19-
2019
#[derive(thiserror::Error, Debug)]
2120
pub enum Error {
2221
#[error("{0} doesn't have an valid host")]

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ pub use moka;
2121
#[cfg(feature = "native-tls-client")]
2222
pub use tokio_native_tls;
2323

24+
#[cfg(any(feature = "native-tls-client", feature = "rustls-client"))]
2425
pub mod default_client;
2526
mod tls;
2627

28+
#[cfg(any(feature = "native-tls-client", feature = "rustls-client"))]
2729
pub use default_client::DefaultClient;
2830

2931
#[derive(Clone)]

0 commit comments

Comments
 (0)