Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix a number of newer clippy lints #2387

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl ClientBuilder {
connect_timeout: None,
connection_verbose: false,
pool_idle_timeout: Some(Duration::from_secs(90)),
pool_max_idle_per_host: std::usize::MAX,
pool_max_idle_per_host: usize::MAX,
// TODO: Re-enable default duration once hyper's HttpConnector is fixed
// to no longer error when an option fails.
tcp_keepalive: None, //Some(Duration::from_secs(60)),
Expand Down
1 change: 1 addition & 0 deletions src/async_impl/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ impl Accepts {
}
}

#[allow(clippy::derivable_impls)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we leave these allows out? We don't run clippy in CI (particularly because it has false positives like these, and I find the allows distracting...)

impl Default for Accepts {
fn default() -> Accepts {
Accepts {
Expand Down
2 changes: 1 addition & 1 deletion src/dns/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl FromStr for Name {
type Err = sealed::InvalidNameError;

fn from_str(host: &str) -> Result<Self, Self::Err> {
HyperName::from_str(host.into())
HyperName::from_str(host)
.map(Name)
.map_err(|_| sealed::InvalidNameError { _ext: () })
}
Expand Down
2 changes: 1 addition & 1 deletion src/into_url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<'a> IntoUrlSealed for &'a String {
}
}

impl<'a> IntoUrlSealed for String {
impl IntoUrlSealed for String {
fn into_url(self) -> crate::Result<Url> {
(&*self).into_url()
}
Expand Down
15 changes: 6 additions & 9 deletions src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,11 @@ impl<S: IntoUrl> IntoProxyScheme for S {
let mut source = e.source();
while let Some(err) = source {
if let Some(parse_error) = err.downcast_ref::<url::ParseError>() {
match parse_error {
url::ParseError::RelativeUrlWithoutBase => {
presumed_to_have_scheme = false;
break;
}
_ => {}
if *parse_error == url::ParseError::RelativeUrlWithoutBase {
presumed_to_have_scheme = false;
break;
}
} else if let Some(_) = err.downcast_ref::<crate::error::BadScheme>() {
} else if err.downcast_ref::<crate::error::BadScheme>().is_some() {
presumed_to_have_scheme = false;
break;
}
Expand Down Expand Up @@ -459,10 +456,10 @@ impl NoProxy {
/// * If neither environment variable is set, `None` is returned
/// * Entries are expected to be comma-separated (whitespace between entries is ignored)
/// * IP addresses (both IPv4 and IPv6) are allowed, as are optional subnet masks (by adding /size,
/// for example "`192.168.1.0/24`").
/// for example "`192.168.1.0/24`").
/// * An entry "`*`" matches all hostnames (this is the only wildcard allowed)
/// * Any other entry is considered a domain name (and may contain a leading dot, for example `google.com`
/// and `.google.com` are equivalent) and would match both that domain AND all subdomains.
/// and `.google.com` are equivalent) and would match both that domain AND all subdomains.
///
/// For example, if `"NO_PROXY=google.com, 192.168.1.0/24"` was set, all of the following would match
/// (and therefore would bypass the proxy):
Expand Down
3 changes: 2 additions & 1 deletion src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl Certificate {

Self::read_pem_certs(&mut reader)?
.iter()
.map(|cert_vec| Certificate::from_der(&cert_vec))
.map(|cert_vec| Certificate::from_der(cert_vec))
.collect::<crate::Result<Vec<Certificate>>>()
}

Expand Down Expand Up @@ -502,6 +502,7 @@ impl fmt::Debug for TlsBackend {
}
}

#[allow(clippy::derivable_impls)]
impl Default for TlsBackend {
fn default() -> TlsBackend {
#[cfg(all(feature = "default-tls", not(feature = "http3")))]
Expand Down