summaryrefslogtreecommitdiffstats
path: root/tokio/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/runtime')
-rw-r--r--tokio/src/runtime/enter.rs6
-rw-r--r--tokio/src/runtime/task/error.rs10
2 files changed, 3 insertions, 13 deletions
diff --git a/tokio/src/runtime/enter.rs b/tokio/src/runtime/enter.rs
index bb6e6be0..f934162b 100644
--- a/tokio/src/runtime/enter.rs
+++ b/tokio/src/runtime/enter.rs
@@ -13,11 +13,7 @@ pub(crate) enum EnterContext {
impl EnterContext {
pub(crate) fn is_entered(self) -> bool {
- if let EnterContext::Entered { .. } = self {
- true
- } else {
- false
- }
+ matches!(self, EnterContext::Entered { .. })
}
}
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.