Skip to content

Commit 8b2cbcf

Browse files
committed
code review adjustment: use client config reference instead of cloning when wrapping async stream
1 parent 1ad18eb commit 8b2cbcf

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

bitreq/src/connection.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ impl AsyncConnection {
276276
timeout_at: Option<Instant>,
277277
client_config: Option<Arc<ClientConfig>>,
278278
) -> Result<AsyncConnection, Error> {
279-
let config = client_config.as_ref().map(Arc::clone);
279+
let client_config_ref = &client_config;
280280

281281
let future = async move {
282282
let socket = Self::connect(params).await?;
283283

284284
if params.https {
285-
Self::wrap_async_stream(socket, params.host, config).await
285+
Self::wrap_async_stream(socket, params.host, client_config_ref).await
286286
} else {
287287
Ok(AsyncHttpStream::Unsecured(socket))
288288
}
@@ -312,7 +312,7 @@ impl AsyncConnection {
312312
async fn wrap_async_stream(
313313
socket: AsyncTcpStream,
314314
host: &str,
315-
client_config: Option<Arc<ClientConfig>>,
315+
client_config: &Option<Arc<ClientConfig>>,
316316
) -> Result<AsyncHttpStream, Error> {
317317
if let Some(client_config) = client_config {
318318
let tls_config = client_config.tls.as_ref().unwrap();
@@ -328,7 +328,7 @@ impl AsyncConnection {
328328
async fn wrap_async_stream(
329329
_socket: AsyncTcpStream,
330330
_host: &str,
331-
_client_config: Option<Arc<ClientConfig>>,
331+
_client_config: &Option<Arc<ClientConfig>>,
332332
) -> Result<AsyncHttpStream, Error> {
333333
Err(Error::HttpsFeatureNotEnabled)
334334
}

0 commit comments

Comments
 (0)