Skip to content

Commit

Permalink
chore: fix a number of newer clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Aug 28, 2024
1 parent 88bd9be commit da249e9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
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)]
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

0 comments on commit da249e9

Please sign in to comment.