mirror of
https://github.com/openharmony/third_party_rust_hyper.git
synced 2026-07-19 22:03:50 -04:00
refactor(error): use matches! macro in Error::is_* methods (#2367)
This commit is contained in:
committed by
GitHub
parent
7899368083
commit
43017ad373
+2
-8
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user