From 0f44f71289c25bb5dbedc082f7122e86755a6a38 Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Mon, 27 Feb 2023 14:42:39 +0900 Subject: [PATCH] nits --- src/backend/mod.rs | 6 +++--- src/config/parse.rs | 4 ++-- src/handler/utils_synth_response.rs | 2 +- src/proxy/proxy_tls.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 7c60c3c..6a92ec8 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -80,7 +80,7 @@ impl Backend { let mut reader = BufReader::new(File::open(certs_path).map_err(|e| { io::Error::new( e.kind(), - format!("Unable to load the certificates [{}]: {}", certs_path_str, e), + format!("Unable to load the certificates [{certs_path_str}]: {e}"), ) })?); rustls_pemfile::certs(&mut reader) @@ -97,7 +97,7 @@ impl Backend { .map_err(|e| { io::Error::new( e.kind(), - format!("Unable to load the certificate keys [{}]: {}", certs_keys_path_str, e), + format!("Unable to load the certificate keys [{certs_keys_path_str}]: {e}"), ) })? .read_to_end(&mut encoded_keys)?; @@ -155,7 +155,7 @@ impl Backend { let mut reader = BufReader::new(File::open(client_ca_cert_path).map_err(|e| { io::Error::new( e.kind(), - format!("Unable to load the client certificates [{}]: {}", certs_path_str, e), + format!("Unable to load the client certificates [{certs_path_str}]: {e}"), ) })?); rustls_pemfile::certs(&mut reader) diff --git a/src/config/parse.rs b/src/config/parse.rs index c5922bf..935f86c 100644 --- a/src/config/parse.rs +++ b/src/config/parse.rs @@ -58,10 +58,10 @@ pub fn parse_opts(globals: &mut Globals) -> std::result::Result<(), anyhow::Erro .flat_map(|x| { let mut v: Vec = vec![]; if let Some(p) = globals.http_port { - v.push(format!("{}:{}", x, p).parse().unwrap()); + v.push(format!("{x}:{p}").parse().unwrap()); } if let Some(p) = globals.https_port { - v.push(format!("{}:{}", x, p).parse().unwrap()); + v.push(format!("{x}:{p}").parse().unwrap()); } v }) diff --git a/src/handler/utils_synth_response.rs b/src/handler/utils_synth_response.rs index 47e8112..e1977f8 100644 --- a/src/handler/utils_synth_response.rs +++ b/src/handler/utils_synth_response.rs @@ -22,7 +22,7 @@ pub(super) fn secure_redirection( let new_uri = Uri::builder().scheme("https").path_and_query(pq); let dest_uri = match tls_port { Some(443) | None => new_uri.authority(server_name), - Some(p) => new_uri.authority(format!("{}:{}", server_name, p)), + Some(p) => new_uri.authority(format!("{server_name}:{p}")), } .build()?; let response = Response::builder() diff --git a/src/proxy/proxy_tls.rs b/src/proxy/proxy_tls.rs index e465e0e..8242d19 100644 --- a/src/proxy/proxy_tls.rs +++ b/src/proxy/proxy_tls.rs @@ -63,7 +63,7 @@ where let handshake_fut = async move { let acceptor = tokio_rustls::LazyConfigAcceptor::new(rustls::server::Acceptor::default(), raw_stream).await; if let Err(e) = acceptor { - return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {}", e))); + return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {e}"))); } let start = acceptor.unwrap(); let client_hello = start.client_hello(); @@ -80,7 +80,7 @@ where let stream = match start.into_stream(server_crypto.unwrap().clone()).await { Ok(s) => s, Err(e) => { - return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {}", e))); + return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {e}"))); } }; self_inner.client_serve(stream, server_clone, client_addr, server_name);