From 7a73fa1871cb3c23e6e16568dd93bd042335d73f Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Mon, 15 Jun 2020 09:33:08 +0200 Subject: [PATCH] cargo fmt --- src/request.rs | 3 +-- src/stream.rs | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/request.rs b/src/request.rs index 21fd367..958208c 100644 --- a/src/request.rs +++ b/src/request.rs @@ -20,8 +20,7 @@ use crate::Response; use super::SerdeValue; lazy_static! { - static ref URL_BASE: Url = - Url::parse("http://localhost/").expect("Failed to parse URL_BASE"); + static ref URL_BASE: Url = Url::parse("http://localhost/").expect("Failed to parse URL_BASE"); } /// Request instances are builders that creates a request. diff --git a/src/stream.rs b/src/stream.rs index 71ed219..4b57673 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -13,7 +13,7 @@ use rustls::StreamOwned; use socks::{TargetAddr, ToTargetAddr}; #[cfg(feature = "native-tls")] -use native_tls::{TlsConnector, TlsStream, HandshakeError}; +use native_tls::{HandshakeError, TlsConnector, TlsStream}; use crate::proxy::Proto; use crate::proxy::Proxy; @@ -192,7 +192,6 @@ pub(crate) fn connect_http(unit: &Unit) -> Result { connect_host(unit, hostname, port).map(Stream::Http) } - #[cfg(all(feature = "tls", feature = "native-certs"))] fn configure_certs(config: &mut rustls::ClientConfig) { config.root_store = @@ -242,11 +241,9 @@ pub(crate) fn connect_https(unit: &Unit) -> Result { let sock = connect_host(unit, hostname, port)?; let tls_connector = TlsConnector::new().map_err(|e| Error::TlsError(e))?; - let stream = tls_connector.connect(hostname, sock).map_err(|e| { - match e { - HandshakeError::Failure(err) => Error::TlsError(err), - _ => Error::BadStatusRead, - } + let stream = tls_connector.connect(hostname, sock).map_err(|e| match e { + HandshakeError::Failure(err) => Error::TlsError(err), + _ => Error::BadStatusRead, })?; Ok(Stream::Https(stream)) @@ -522,4 +519,3 @@ pub(crate) fn connect_test(unit: &Unit) -> Result { pub(crate) fn connect_https(unit: &Unit) -> Result { Err(Error::UnknownScheme(unit.url.scheme().to_string())) } -