Fix newly introduced clippy warnings

pull/247/head
Daniel Abramov 3 years ago
parent 89697449ff
commit 6c4d2bab04
  1. 2
      src/client.rs
  2. 6
      src/handshake/server.rs

@ -56,7 +56,7 @@ pub fn connect_with_config<Req: IntoClientRequest>(
Mode::Tls => 443, Mode::Tls => 443,
}); });
let addrs = (host, port).to_socket_addrs()?; let addrs = (host, port).to_socket_addrs()?;
let mut stream = connect_to_some(addrs.as_slice(), &request.uri())?; let mut stream = connect_to_some(addrs.as_slice(), request.uri())?;
NoDelay::set_nodelay(&mut stream, true)?; NoDelay::set_nodelay(&mut stream, true)?;
#[cfg(not(any(feature = "native-tls", feature = "__rustls-tls")))] #[cfg(not(any(feature = "native-tls", feature = "__rustls-tls")))]

@ -82,7 +82,7 @@ fn create_parts<T>(request: &HttpRequest<T>) -> Result<Builder> {
/// Create a response for the request. /// Create a response for the request.
pub fn create_response(request: &Request) -> Result<Response> { pub fn create_response(request: &Request) -> Result<Response> {
Ok(create_parts(&request)?.body(())?) Ok(create_parts(request)?.body(())?)
} }
/// Create a response for the request with a custom body. /// Create a response for the request with a custom body.
@ -90,7 +90,7 @@ pub fn create_response_with_body<T>(
request: &HttpRequest<T>, request: &HttpRequest<T>,
generate_body: impl FnOnce() -> T, generate_body: impl FnOnce() -> T,
) -> Result<HttpResponse<T>> { ) -> Result<HttpResponse<T>> {
Ok(create_parts(&request)?.body(generate_body())?) Ok(create_parts(request)?.body(generate_body())?)
} }
// Assumes that this is a valid response // Assumes that this is a valid response
@ -263,7 +263,7 @@ impl<S: Read + Write, C: Callback> HandshakeRole for ServerHandshake<S, C> {
let resp = self.error_response.as_ref().unwrap(); let resp = self.error_response.as_ref().unwrap();
let mut output = vec![]; let mut output = vec![];
write_response(&mut output, &resp)?; write_response(&mut output, resp)?;
if let Some(body) = resp.body() { if let Some(body) = resp.body() {
output.extend_from_slice(body.as_bytes()); output.extend_from_slice(body.as_bytes());

Loading…
Cancel
Save