summaryrefslogtreecommitdiffstats
path: root/tokio-timer
diff options
context:
space:
mode:
authorSteffen Butzer <steffengy@users.noreply.github.com>2019-07-04 08:06:03 +0200
committerCarl Lerche <me@carllerche.com>2019-07-03 23:06:03 -0700
commit0651f0942722a76be1f330bc42e365511fc81635 (patch)
treeb237cfadfaa7be322ddaf41db9ff9c9d61e47062 /tokio-timer
parent516251052d9b57f353666eab1ab360d362c1ef7e (diff)
Remove usage of deprecated std::error::Error methods (#1206) (#1245)
Diffstat (limited to 'tokio-timer')
-rw-r--r--tokio-timer/src/deadline.rs12
-rw-r--r--tokio-timer/src/error.rs19
2 files changed, 8 insertions, 23 deletions
diff --git a/tokio-timer/src/deadline.rs b/tokio-timer/src/deadline.rs
index 29f0c827..9df67da6 100644
--- a/tokio-timer/src/deadline.rs
+++ b/tokio-timer/src/deadline.rs
@@ -147,17 +147,7 @@ impl<T> DeadlineError<T> {
}
}
-impl<T: error::Error> error::Error for DeadlineError<T> {
- fn description(&self) -> &str {
- use self::Kind::*;
-
- match self.0 {
- Inner(ref e) => e.description(),
- Elapsed => "deadline has elapsed",
- Timer(ref e) => e.description(),
- }
- }
-}
+impl<T: error::Error> error::Error for DeadlineError<T> {}
impl<T: fmt::Display> fmt::Display for DeadlineError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/tokio-timer/src/error.rs b/tokio-timer/src/error.rs
index 968957fa..994eec1f 100644
--- a/tokio-timer/src/error.rs
+++ b/tokio-timer/src/error.rs
@@ -58,20 +58,15 @@ impl Error {
}
}
-impl error::Error for Error {
- fn description(&self) -> &str {
- use self::Kind::*;
-
- match self.0 {
- Shutdown => "timer is shutdown",
- AtCapacity => "timer is at capacity and cannot create a new entry",
- }
- }
-}
+impl error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
- use std::error::Error;
- self.description().fmt(fmt)
+ use self::Kind::*;
+ let descr = match self.0 {
+ Shutdown => "timer is shutdown",
+ AtCapacity => "timer is at capacity and cannot create a new entry",
+ };
+ write!(fmt, "{}", descr)
}
}