diff --git a/src/async_impl/body.rs b/src/async_impl/body.rs index bf19471..3e58666 100644 --- a/src/async_impl/body.rs +++ b/src/async_impl/body.rs @@ -222,7 +222,7 @@ impl HttpBody for ImplStream { if bytes.is_empty() { None } else { - Some(Ok(std::mem::replace(bytes, Bytes::new()).into())) + Some(Ok(std::mem::replace(bytes, Bytes::new()))) } } }; diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs index 5deb05f..da91acf 100644 --- a/src/async_impl/client.rs +++ b/src/async_impl/client.rs @@ -1021,14 +1021,10 @@ impl Client { let accept_encoding = self.inner.accepts.as_str(); - if accept_encoding.is_some() - && !headers.contains_key(ACCEPT_ENCODING) - && !headers.contains_key(RANGE) - { - headers.insert( - ACCEPT_ENCODING, - HeaderValue::from_static(accept_encoding.unwrap()), - ); + if let Some(accept_encoding) = accept_encoding { + if !headers.contains_key(ACCEPT_ENCODING) && !headers.contains_key(RANGE) { + headers.insert(ACCEPT_ENCODING, HeaderValue::from_static(accept_encoding)); + } } let uri = expect_uri(&url); @@ -1045,13 +1041,13 @@ impl Client { let mut req = hyper::Request::builder() .method(method.clone()) - .uri(uri.clone()) + .uri(uri) .body(body.into_stream()) .expect("valid request parts"); let timeout = timeout .or(self.inner.request_timeout) - .map(|dur| tokio::time::delay_for(dur)); + .map(tokio::time::delay_for); *req.headers_mut() = headers.clone(); diff --git a/src/async_impl/decoder.rs b/src/async_impl/decoder.rs index 580b03e..e5c9c3f 100644 --- a/src/async_impl/decoder.rs +++ b/src/async_impl/decoder.rs @@ -225,7 +225,7 @@ impl Stream for Decoder { } Poll::Pending => return Poll::Pending, }, - Inner::PlainText(ref mut body) => return Pin::new(body).poll_next(cx), + Inner::PlainText(ref mut body) => Pin::new(body).poll_next(cx), #[cfg(feature = "gzip")] Inner::Gzip(ref mut decoder) => { return match futures_core::ready!(Pin::new(decoder).poll_next(cx)) { @@ -242,7 +242,7 @@ impl Stream for Decoder { None => Poll::Ready(None), }; } - }; + } } } diff --git a/src/async_impl/request.rs b/src/async_impl/request.rs index e3db44e..ba7f7f3 100644 --- a/src/async_impl/request.rs +++ b/src/async_impl/request.rs @@ -4,12 +4,10 @@ use std::future::Future; use std::io::Write; use std::time::Duration; -use base64; use base64::write::EncoderWriter as Base64Encoder; use serde::Serialize; #[cfg(feature = "json")] use serde_json; -use serde_urlencoded; use super::body::Body; use super::client::{Client, Pending}; diff --git a/src/async_impl/response.rs b/src/async_impl/response.rs index 02413b2..ef7e74a 100644 --- a/src/async_impl/response.rs +++ b/src/async_impl/response.rs @@ -5,7 +5,6 @@ use std::net::SocketAddr; use bytes::Bytes; use encoding_rs::{Encoding, UTF_8}; use futures_util::stream::StreamExt; -use http; use hyper::client::connect::HttpInfo; use hyper::{HeaderMap, StatusCode, Version}; use mime::Mime; diff --git a/src/proxy.rs b/src/proxy.rs index 59f3ce6..d653896 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -706,10 +706,8 @@ fn get_from_environment() -> SystemProxyMap { let mut proxies = HashMap::new(); if is_cgi() { - if log::log_enabled!(log::Level::Warn) { - if env::var_os("HTTP_PROXY").is_some() { - log::warn!("HTTP_PROXY environment variable ignored in CGI"); - } + if log::log_enabled!(log::Level::Warn) && env::var_os("HTTP_PROXY").is_some() { + log::warn!("HTTP_PROXY environment variable ignored in CGI"); } } else if !insert_from_env(&mut proxies, "http", "HTTP_PROXY") { insert_from_env(&mut proxies, "http", "http_proxy");