mirror of https://github.com/fafhrd91/actix-web
clippy
This commit is contained in:
parent
1a7ac0217e
commit
218e8e595f
|
@ -91,23 +91,13 @@ impl ServiceConfig {
|
|||
/// Returns `None` if this `ServiceConfig was` constructed with `client_request_timeout: 0`.
|
||||
pub fn client_request_deadline(&self) -> Option<Instant> {
|
||||
let timeout = self.0.client_request_timeout;
|
||||
|
||||
if timeout != Duration::ZERO {
|
||||
Some(self.now() + timeout)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
(timeout != Duration::ZERO).then(|| self.now() + timeout)
|
||||
}
|
||||
|
||||
/// Creates a time object representing the deadline for the client to disconnect.
|
||||
pub fn client_disconnect_deadline(&self) -> Option<Instant> {
|
||||
let timeout = self.0.client_disconnect_timeout;
|
||||
|
||||
if timeout != Duration::ZERO {
|
||||
Some(self.now() + timeout)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
(timeout != Duration::ZERO).then(|| self.now() + timeout)
|
||||
}
|
||||
|
||||
pub(crate) fn now(&self) -> Instant {
|
||||
|
|
|
@ -207,13 +207,19 @@ where
|
|||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::None => write!(f, "None"),
|
||||
Self::ExpectCall { .. } => f.debug_struct("ExpectCall").finish_non_exhaustive(),
|
||||
Self::ServiceCall { .. } => f.debug_struct("ServiceCall").finish_non_exhaustive(),
|
||||
Self::SendPayload { .. } => f.debug_struct("SendPayload").finish_non_exhaustive(),
|
||||
Self::SendErrorPayload { .. } => {
|
||||
f.debug_struct("SendErrorPayload").finish_non_exhaustive()
|
||||
Self::None => write!(f, "State::None"),
|
||||
Self::ExpectCall { .. } => {
|
||||
f.debug_struct("State::ExpectCall").finish_non_exhaustive()
|
||||
}
|
||||
Self::ServiceCall { .. } => {
|
||||
f.debug_struct("State::ServiceCall").finish_non_exhaustive()
|
||||
}
|
||||
Self::SendPayload { .. } => {
|
||||
f.debug_struct("State::SendPayload").finish_non_exhaustive()
|
||||
}
|
||||
Self::SendErrorPayload { .. } => f
|
||||
.debug_struct("State::SendErrorPayload")
|
||||
.finish_non_exhaustive(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -771,7 +777,7 @@ where
|
|||
Ok(None) => break,
|
||||
|
||||
Err(ParseError::Io(err)) => {
|
||||
log::trace!("io error: {}", &err);
|
||||
log::trace!("I/O error: {}", &err);
|
||||
self.as_mut().client_disconnected();
|
||||
this = self.as_mut().project();
|
||||
*this.error = Some(DispatchError::Io(err));
|
||||
|
|
|
@ -21,7 +21,7 @@ pub enum KeepAlive {
|
|||
|
||||
impl KeepAlive {
|
||||
pub(crate) fn enabled(&self) -> bool {
|
||||
matches!(self, Self::Timeout(_) | Self::Os)
|
||||
!matches!(self, Self::Disabled)
|
||||
}
|
||||
|
||||
pub(crate) fn duration(&self) -> Option<Duration> {
|
||||
|
|
Loading…
Reference in New Issue