From 8bbb70cb94bfbe485e94994b2da35675597586c6 Mon Sep 17 00:00:00 2001 From: Jonathan Reem Date: Thu, 11 Feb 2016 17:24:57 -0800 Subject: [PATCH] Remove unnecessary bounds on Error and Display implementations for TryLockError and PoisonError. --- src/libstd/sys/common/poison.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libstd/sys/common/poison.rs b/src/libstd/sys/common/poison.rs index 2cfa04c843b6b..d858c0027558c 100644 --- a/src/libstd/sys/common/poison.rs +++ b/src/libstd/sys/common/poison.rs @@ -111,7 +111,7 @@ impl fmt::Display for PoisonError { } #[stable(feature = "rust1", since = "1.0.0")] -impl Error for PoisonError { +impl Error for PoisonError { fn description(&self) -> &str { "poisoned lock: another task failed inside" } @@ -158,14 +158,17 @@ impl fmt::Debug for TryLockError { } #[stable(feature = "rust1", since = "1.0.0")] -impl fmt::Display for TryLockError { +impl fmt::Display for TryLockError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.description().fmt(f) + match *self { + TryLockError::Poisoned(..) => "poisoned lock: another task failed inside", + TryLockError::WouldBlock => "try_lock failed because the operation would block" + }.fmt(f) } } #[stable(feature = "rust1", since = "1.0.0")] -impl Error for TryLockError { +impl Error for TryLockError { fn description(&self) -> &str { match *self { TryLockError::Poisoned(ref p) => p.description(),