Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 92a54ba

Browse files
tinaunYamakaky
authored andcommitted
Remove impl Deref<Kind> for Error
fixes #184
1 parent fb9ea0e commit 92a54ba

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- [Remove `impl Deref<Kind> for Error`](https://github.com/rust-lang-nursery/error-chain/pull/192)
4+
35
# 0.11.0
46

57
- Change last rust version supported to 1.14

src/error_chain.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,17 @@ macro_rules! impl_error_chain_processed {
166166
where F: FnOnce() -> EK, EK: Into<$error_kind_name> {
167167
$error_name::with_chain(self, Self::from_kind(error().into()))
168168
}
169+
170+
/// A short description of the error.
171+
/// This method is identical to [`Error::description()`](https://doc.rust-lang.org/nightly/std/error/trait.Error.html#tymethod.description)
172+
pub fn description(&self) -> &str {
173+
self.0.description()
174+
}
169175
}
170176

171177
impl ::std::error::Error for $error_name {
172178
fn description(&self) -> &str {
173-
self.0.description()
179+
self.description()
174180
}
175181

176182
#[allow(unknown_lints, unused_doc_comment)]
@@ -239,14 +245,6 @@ macro_rules! impl_error_chain_processed {
239245
}
240246
}
241247

242-
impl ::std::ops::Deref for $error_name {
243-
type Target = $error_kind_name;
244-
245-
fn deref(&self) -> &Self::Target {
246-
&self.0
247-
}
248-
}
249-
250248

251249
// The ErrorKind type
252250
// --------------

0 commit comments

Comments
 (0)