Skip to content

Commit 4a1dc82

Browse files
committed
src: remove Clone from HttpClient impls
1 parent 3cfd120 commit 4a1dc82

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

src/h1.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ impl H1Client {
2222
}
2323
}
2424

25-
impl Clone for H1Client {
26-
fn clone(&self) -> Self {
27-
Self {}
28-
}
29-
}
30-
3125
#[async_trait]
3226
impl HttpClient for H1Client {
3327
async fn send(&self, mut req: Request) -> Result<Response, Error> {

src/isahc.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ use super::{async_trait, Body, Error, HttpClient, Request, Response};
44

55
use async_std::io::BufReader;
66
use isahc::http;
7-
use std::sync::Arc;
87

98
/// Curl-based HTTP Client.
109
#[derive(Debug)]
11-
pub struct IsahcClient {
12-
client: Arc<isahc::HttpClient>,
13-
}
10+
pub struct IsahcClient(isahc::HttpClient);
1411

1512
impl Default for IsahcClient {
1613
fn default() -> Self {
@@ -26,17 +23,7 @@ impl IsahcClient {
2623

2724
/// Create from externally initialized and configured client.
2825
pub fn from_client(client: isahc::HttpClient) -> Self {
29-
Self {
30-
client: Arc::new(client),
31-
}
32-
}
33-
}
34-
35-
impl Clone for IsahcClient {
36-
fn clone(&self) -> Self {
37-
Self {
38-
client: self.client.clone(),
39-
}
26+
Self(client)
4027
}
4128
}
4229

@@ -59,7 +46,7 @@ impl HttpClient for IsahcClient {
5946
};
6047

6148
let request = builder.body(body).unwrap();
62-
let res = self.client.send_async(request).await.map_err(Error::from)?;
49+
let res = self.0.send_async(request).await.map_err(Error::from)?;
6350
let (parts, body) = res.into_parts();
6451
let len = body.len().map(|len| len as usize);
6552
let body = Body::from_reader(BufReader::new(body), len);

src/wasm.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ impl WasmClient {
2121
}
2222
}
2323

24-
impl Clone for WasmClient {
25-
fn clone(&self) -> Self {
26-
Self { _priv: () }
27-
}
28-
}
29-
3024
impl HttpClient for WasmClient {
3125
fn send<'a, 'async_trait>(
3226
&'a self,

0 commit comments

Comments
 (0)