diff options
Diffstat (limited to 'tokio/src/runtime/task/error.rs')
-rw-r--r-- | tokio/src/runtime/task/error.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tokio/src/runtime/task/error.rs b/tokio/src/runtime/task/error.rs index dfdec44c..509642d4 100644 --- a/tokio/src/runtime/task/error.rs +++ b/tokio/src/runtime/task/error.rs @@ -30,10 +30,7 @@ impl JoinError { /// Returns true if the error was caused by the task being cancelled pub fn is_cancelled(&self) -> bool { - match &self.repr { - Repr::Cancelled => true, - _ => false, - } + matches!(&self.repr, Repr::Cancelled) } /// Returns true if the error was caused by the task panicking @@ -53,10 +50,7 @@ impl JoinError { /// } /// ``` pub fn is_panic(&self) -> bool { - match &self.repr { - Repr::Panic(_) => true, - _ => false, - } + matches!(&self.repr, Repr::Panic(_)) } /// Consumes the join error, returning the object with which the task panicked. |