Skip to content

Commit

Permalink
refactor(error): use matches! macro in Error::is_* methods (#2367)
Browse files Browse the repository at this point in the history
  • Loading branch information
bishtpawan authored Dec 21, 2020
1 parent 1dd761c commit 6c593c2
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,12 @@ pub(crate) struct TimedOut;
impl Error {
/// Returns true if this was an HTTP parse error.
pub fn is_parse(&self) -> bool {
match self.inner.kind {
Kind::Parse(_) => true,
_ => false,
}
matches!(self.inner.kind, Kind::Parse(_))
}

/// Returns true if this error was caused by user code.
pub fn is_user(&self) -> bool {
match self.inner.kind {
Kind::User(_) => true,
_ => false,
}
matches!(self.inner.kind, Kind::User(_))
}

/// Returns true if this was about a `Request` that was canceled.
Expand Down

0 comments on commit 6c593c2

Please sign in to comment.