Fix clippy warnings (#981)
* refactor: fix clippy warnings * refactor: fix redundant_closure * refactor: fix collapsible if * refactor: remove unnecessary_unwrap
This commit is contained in:
		| @@ -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()))) | ||||
|                 } | ||||
|             } | ||||
|         }; | ||||
|   | ||||
| @@ -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(); | ||||
|  | ||||
|   | ||||
| @@ -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), | ||||
|                 }; | ||||
|             } | ||||
|         }; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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}; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user