1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-24 22:37:35 +02:00

fix clippy warning on nightly (#2088)

* fix clippy warning on nightly
This commit is contained in:
fakeshadow
2021-03-19 04:25:35 -07:00
committed by GitHub
parent 78fcd0237a
commit 351286486c
11 changed files with 30 additions and 52 deletions

View File

@ -325,7 +325,7 @@ where
}
}
const H2_UNREACHABLE_WRITE: &'static str = "H2Connection can not impl AsyncWrite trait";
const H2_UNREACHABLE_WRITE: &str = "H2Connection can not impl AsyncWrite trait";
impl<A, B> AsyncWrite for Connection<A, B>
where

View File

@ -126,9 +126,7 @@ impl ServiceConfig {
pub fn client_timer(&self) -> Option<Sleep> {
let delay_time = self.0.client_timeout;
if delay_time != 0 {
Some(sleep_until(
self.0.date_service.now() + Duration::from_millis(delay_time),
))
Some(sleep_until(self.now() + Duration::from_millis(delay_time)))
} else {
None
}
@ -138,7 +136,7 @@ impl ServiceConfig {
pub fn client_timer_expire(&self) -> Option<Instant> {
let delay = self.0.client_timeout;
if delay != 0 {
Some(self.0.date_service.now() + Duration::from_millis(delay))
Some(self.now() + Duration::from_millis(delay))
} else {
None
}
@ -148,7 +146,7 @@ impl ServiceConfig {
pub fn client_disconnect_timer(&self) -> Option<Instant> {
let delay = self.0.client_disconnect;
if delay != 0 {
Some(self.0.date_service.now() + Duration::from_millis(delay))
Some(self.now() + Duration::from_millis(delay))
} else {
None
}
@ -157,20 +155,12 @@ impl ServiceConfig {
#[inline]
/// Return keep-alive timer delay is configured.
pub fn keep_alive_timer(&self) -> Option<Sleep> {
if let Some(ka) = self.0.keep_alive {
Some(sleep_until(self.0.date_service.now() + ka))
} else {
None
}
self.keep_alive().map(|ka| sleep_until(self.now() + ka))
}
/// Keep-alive expire time
pub fn keep_alive_expire(&self) -> Option<Instant> {
if let Some(ka) = self.0.keep_alive {
Some(self.0.date_service.now() + ka)
} else {
None
}
self.keep_alive().map(|ka| self.now() + ka)
}
#[inline]

View File

@ -127,9 +127,8 @@ impl Display for EntityTag {
impl FromStr for EntityTag {
type Err = crate::error::ParseError;
fn from_str(s: &str) -> Result<EntityTag, crate::error::ParseError> {
let length: usize = s.len();
let slice = &s[..];
fn from_str(slice: &str) -> Result<EntityTag, crate::error::ParseError> {
let length = slice.len();
// Early exits if it doesn't terminate in a DQUOTE.
if !slice.ends_with('"') || slice.len() < 2 {
return Err(crate::error::ParseError::Header);

View File

@ -88,9 +88,9 @@ pub fn parse_extended_value(
};
Ok(ExtendedValue {
value,
charset,
language_tag,
value,
})
}