Fix new clippy lints (#561)
This commit is contained in:
committed by
GitHub
parent
28d667ade9
commit
a2836c49a7
@@ -6,6 +6,8 @@
|
|||||||
#![allow(clippy::match_like_matches_macro)]
|
#![allow(clippy::match_like_matches_macro)]
|
||||||
// we're not changing public api due to a lint.
|
// we're not changing public api due to a lint.
|
||||||
#![allow(clippy::upper_case_acronyms)]
|
#![allow(clippy::upper_case_acronyms)]
|
||||||
|
#![allow(clippy::result_large_err)]
|
||||||
|
#![allow(clippy::only_used_in_recursion)]
|
||||||
|
|
||||||
//!<div align="center">
|
//!<div align="center">
|
||||||
//! <!-- Version -->
|
//! <!-- Version -->
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ impl Proxy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let remaining_parts = proxy_parts.next();
|
let remaining_parts = proxy_parts.next();
|
||||||
if remaining_parts == None {
|
if remaining_parts.is_none() {
|
||||||
return Err(ErrorKind::InvalidProxyUrl.new());
|
return Err(ErrorKind::InvalidProxyUrl.new());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ impl Proxy {
|
|||||||
|
|
||||||
pub(crate) fn connect<S: AsRef<str>>(&self, host: S, port: u16) -> String {
|
pub(crate) fn connect<S: AsRef<str>>(&self, host: S, port: u16) -> String {
|
||||||
let authorization = if self.use_authorization() {
|
let authorization = if self.use_authorization() {
|
||||||
let creds = base64::encode(&format!(
|
let creds = base64::encode(format!(
|
||||||
"{}:{}",
|
"{}:{}",
|
||||||
self.user.clone().unwrap_or_default(),
|
self.user.clone().unwrap_or_default(),
|
||||||
self.password.clone().unwrap_or_default()
|
self.password.clone().unwrap_or_default()
|
||||||
|
|||||||
@@ -361,7 +361,8 @@ pub(crate) fn connect_host(
|
|||||||
debug!("connecting to {} at {}", netloc, &sock_addr);
|
debug!("connecting to {} at {}", netloc, &sock_addr);
|
||||||
|
|
||||||
// connect with a configured timeout.
|
// 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(
|
connect_socks(
|
||||||
unit,
|
unit,
|
||||||
proxy.clone().unwrap(),
|
proxy.clone().unwrap(),
|
||||||
@@ -374,7 +375,7 @@ pub(crate) fn connect_host(
|
|||||||
} else if let Some(timeout) = timeout {
|
} else if let Some(timeout) = timeout {
|
||||||
TcpStream::connect_timeout(&sock_addr, timeout)
|
TcpStream::connect_timeout(&sock_addr, timeout)
|
||||||
} else {
|
} else {
|
||||||
TcpStream::connect(&sock_addr)
|
TcpStream::connect(sock_addr)
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(stream) = stream {
|
if let Ok(stream) = stream {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ impl Unit {
|
|||||||
if (!username.is_empty() || !password.is_empty())
|
if (!username.is_empty() || !password.is_empty())
|
||||||
&& get_header(&headers, "authorization").is_none()
|
&& 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)));
|
extra.push(Header::new("Authorization", &format!("Basic {}", encoded)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user