Revert default-client changes

This was changed in the previous commit when it didn't need to be 3a56e67
This commit is contained in:
Jeremiah Senkpiel 2021-03-01 10:40:23 -08:00
parent 3a56e6708a
commit cbd2185fbc
3 changed files with 7 additions and 47 deletions

View File

@ -100,4 +100,4 @@ jobs:
- name: Check all feature combinations works properly
# * `--feature-powerset` - run for the feature powerset of the package
# * `--no-dev-deps` - build without dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
run: cargo hack check --feature-powerset --no-dev-deps
run: cargo hack check --feature-powerset --no-dev-deps --skip=default-client,wasm-client

View File

@ -10,7 +10,7 @@ use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "curl-client")] {
use http_client::isahc::IsahcClient as DefaultClient;
} else if #[cfg(all(feature = "wasm-client", target_arch = "wasm32"))] {
} else if #[cfg(feature = "wasm-client")] {
use http_client::wasm::WasmClient as DefaultClient;
} else if #[cfg(feature = "h1-client")] {
use http_client::h1::H1Client as DefaultClient;
@ -76,15 +76,7 @@ impl fmt::Debug for Client {
}
}
#[cfg(all(
feature = "default-client",
any(
feature = "curl-client",
all(feature = "wasm-client", target_arch = "wasm32"),
feature = "h1-client",
feature = "hyper-client"
)
))]
#[cfg(feature = "default-client")]
impl Default for Client {
fn default() -> Self {
Self::new()
@ -105,30 +97,14 @@ impl Client {
/// let res = client.send(req).await?;
/// # Ok(()) }
/// ```
#[cfg(all(
feature = "default-client",
any(
feature = "curl-client",
all(feature = "wasm-client", target_arch = "wasm32"),
feature = "h1-client",
feature = "hyper-client"
)
))]
#[cfg(feature = "default-client")]
pub fn new() -> Self {
Self::with_http_client(DefaultClient::new())
}
pub(crate) fn new_shared_or_panic() -> Self {
cfg_if! {
if #[cfg(all(
feature = "default-client",
any(
feature = "curl-client",
all(feature = "wasm-client", target_arch = "wasm32"),
feature = "h1-client",
feature = "hyper-client"
)
))] {
if #[cfg(feature = "default-client")] {
Self::new_shared()
} else {
panic!("default client not configured")
@ -164,15 +140,7 @@ impl Client {
client
}
#[cfg(all(
feature = "default-client",
any(
feature = "curl-client",
all(feature = "wasm-client", target_arch = "wasm32"),
feature = "h1-client",
feature = "hyper-client"
)
))]
#[cfg(feature = "default-client")]
pub(crate) fn new_shared() -> Self {
cfg_if! {
if #[cfg(any(feature = "curl-client", feature = "hyper-client"))] {

View File

@ -96,15 +96,7 @@ pub use request_builder::RequestBuilder;
pub use response::{DecodeError, Response};
cfg_if::cfg_if! {
if #[cfg(all(
feature = "default-client",
any(
feature = "curl-client",
all(feature = "wasm-client", target_arch = "wasm32"),
feature = "h1-client",
feature = "hyper-client"
)
))] {
if #[cfg(feature = "default-client")] {
mod one_off;
pub use one_off::{connect, delete, get, head, options, patch, post, put, trace};