Skip to content

Commit c552885

Browse files
taiki-ecramertj
authored andcommitted
Remove Error::description implementations
1 parent e5f2221 commit c552885

File tree

5 files changed

+8
-41
lines changed

5 files changed

+8
-41
lines changed

futures-channel/src/mpsc/mod.rs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,7 @@ impl fmt::Display for SendError {
178178
}
179179
}
180180

181-
impl Error for SendError {
182-
fn description(&self) -> &str {
183-
if self.is_full() {
184-
"send failed because channel is full"
185-
} else {
186-
"send failed because receiver is gone"
187-
}
188-
}
189-
}
181+
impl Error for SendError {}
190182

191183
impl SendError {
192184
/// Returns true if this error is a result of the channel being full.
@@ -224,15 +216,7 @@ impl<T> fmt::Display for TrySendError<T> {
224216
}
225217
}
226218

227-
impl<T: Any> Error for TrySendError<T> {
228-
fn description(&self) -> &str {
229-
if self.is_full() {
230-
"send failed because channel is full"
231-
} else {
232-
"send failed because receiver is gone"
233-
}
234-
}
235-
}
219+
impl<T: Any> Error for TrySendError<T> {}
236220

237221
impl<T> TrySendError<T> {
238222
/// Returns true if this error is a result of the channel being full.
@@ -265,15 +249,11 @@ impl fmt::Debug for TryRecvError {
265249

266250
impl fmt::Display for TryRecvError {
267251
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
268-
fmt.write_str(self.description())
252+
write!(fmt, "receiver channel is empty")
269253
}
270254
}
271255

272-
impl Error for TryRecvError {
273-
fn description(&self) -> &str {
274-
"receiver channel is empty"
275-
}
276-
}
256+
impl Error for TryRecvError {}
277257

278258
#[derive(Debug)]
279259
struct Inner<T> {

futures-channel/src/oneshot.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,7 @@ impl fmt::Display for Canceled {
387387
}
388388
}
389389

390-
impl Error for Canceled {
391-
fn description(&self) -> &str {
392-
"oneshot canceled"
393-
}
394-
}
390+
impl Error for Canceled {}
395391

396392
impl<T> Receiver<T> {
397393
/// Gracefully close this receiver, preventing any subsequent attempts to

futures-util/src/lock/bilock.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,7 @@ impl<T> fmt::Display for ReuniteError<T> {
213213
}
214214

215215
#[cfg(feature = "std")]
216-
impl<T: Any> Error for ReuniteError<T> {
217-
fn description(&self) -> &str {
218-
"tried to reunite two BiLocks that don't form a pair"
219-
}
220-
}
216+
impl<T: Any> Error for ReuniteError<T> {}
221217

222218
/// Returned RAII guard from the `poll_lock` method.
223219
///

futures-util/src/sink/drain.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ impl fmt::Display for DrainError {
7575
}
7676

7777
#[cfg(feature = "std")]
78-
impl std::error::Error for DrainError {
79-
}
78+
impl std::error::Error for DrainError {}
8079

8180
impl DrainError {
8281
/// Convert this drain error into any type

futures-util/src/stream/split.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,4 @@ impl<T: Sink<Item>, Item> fmt::Display for ReuniteError<T, Item> {
144144
}
145145

146146
#[cfg(feature = "std")]
147-
impl<T: Any + Sink<Item>, Item> Error for ReuniteError<T, Item> {
148-
fn description(&self) -> &str {
149-
"tried to reunite a SplitStream and SplitSink that don't form a pair"
150-
}
151-
}
147+
impl<T: Any + Sink<Item>, Item> Error for ReuniteError<T, Item> {}

0 commit comments

Comments
 (0)