Fix new clippy lints (#561)

This commit is contained in:
Jacob Hoffman-Andrews
2022-11-26 01:28:36 -08:00
committed by GitHub
parent 28d667ade9
commit a2836c49a7
4 changed files with 8 additions and 5 deletions

View File

@@ -6,6 +6,8 @@
#![allow(clippy::match_like_matches_macro)]
// we're not changing public api due to a lint.
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::result_large_err)]
#![allow(clippy::only_used_in_recursion)]
//!<div align="center">
//! <!-- Version -->

View File

@@ -101,7 +101,7 @@ impl Proxy {
};
let remaining_parts = proxy_parts.next();
if remaining_parts == None {
if remaining_parts.is_none() {
return Err(ErrorKind::InvalidProxyUrl.new());
}
@@ -131,7 +131,7 @@ impl Proxy {
pub(crate) fn connect<S: AsRef<str>>(&self, host: S, port: u16) -> String {
let authorization = if self.use_authorization() {
let creds = base64::encode(&format!(
let creds = base64::encode(format!(
"{}:{}",
self.user.clone().unwrap_or_default(),
self.password.clone().unwrap_or_default()

View File

@@ -361,7 +361,8 @@ pub(crate) fn connect_host(
debug!("connecting to {} at {}", netloc, &sock_addr);
// connect with a configured timeout.
let stream = if None != proto && Some(Proto::HTTPConnect) != proto {
#[allow(clippy::unnecessary_unwrap)]
let stream = if proto.is_some() && Some(Proto::HTTPConnect) != proto {
connect_socks(
unit,
proxy.clone().unwrap(),
@@ -374,7 +375,7 @@ pub(crate) fn connect_host(
} else if let Some(timeout) = timeout {
TcpStream::connect_timeout(&sock_addr, timeout)
} else {
TcpStream::connect(&sock_addr)
TcpStream::connect(sock_addr)
};
if let Ok(stream) = stream {

View File

@@ -87,7 +87,7 @@ impl Unit {
if (!username.is_empty() || !password.is_empty())
&& get_header(&headers, "authorization").is_none()
{
let encoded = base64::encode(&format!("{}:{}", username, password));
let encoded = base64::encode(format!("{}:{}", username, password));
extra.push(Header::new("Authorization", &format!("Basic {}", encoded)));
}