From: Wolfgang Bumiller Date: Wed, 20 Jul 2022 11:31:58 +0000 (+0200) Subject: http: clippy fixups X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=94d388b98873d4ec9d692284846e40a2023abbeb;p=proxmox.git http: clippy fixups Signed-off-by: Wolfgang Bumiller --- diff --git a/proxmox-http/src/client/connector.rs b/proxmox-http/src/client/connector.rs index a01dbca4..d6ba9dd2 100644 --- a/proxmox-http/src/client/connector.rs +++ b/proxmox-http/src/client/connector.rs @@ -170,6 +170,7 @@ impl hyper::service::Service for HttpsConnector { if use_connect { async move { + use std::fmt::Write as _; let tcp_stream = connector.call(proxy_uri).await.map_err(|err| { format_err!("error connecting to {} - {}", proxy_authority, err) })?; @@ -181,10 +182,13 @@ impl hyper::service::Service for HttpsConnector { let mut connect_request = format!("CONNECT {0}:{1} HTTP/1.1\r\n", host, port); if let Some(authorization) = authorization { - connect_request - .push_str(&format!("Proxy-Authorization: {}\r\n", authorization)); + let _ = write!( + connect_request, + "Proxy-Authorization: {}\r\n", + authorization + ); } - connect_request.push_str(&format!("Host: {0}:{1}\r\n\r\n", host, port)); + let _ = write!(connect_request, "Host: {0}:{1}\r\n\r\n", host, port); tcp_stream.write_all(connect_request.as_bytes()).await?; tcp_stream.flush().await?; diff --git a/proxmox-http/src/client/rate_limited_stream.rs b/proxmox-http/src/client/rate_limited_stream.rs index 8fd07a34..0fbc559a 100644 --- a/proxmox-http/src/client/rate_limited_stream.rs +++ b/proxmox-http/src/client/rate_limited_stream.rs @@ -15,14 +15,16 @@ use super::{RateLimiter, ShareableRateLimit}; type SharedRateLimit = Arc; +pub type RateLimiterCallback = + dyn Fn() -> (Option, Option) + Send; + /// A rate limited stream using [RateLimiter] pub struct RateLimitedStream { read_limiter: Option, read_delay: Option>>, write_limiter: Option, write_delay: Option>>, - update_limiter_cb: - Option (Option, Option) + Send>>, + update_limiter_cb: Option>, last_limiter_update: Instant, stream: S, }