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

Commit 187959b

Browse files
committed
Wrong trait constraint in ResultExt implementation.
Fixes #66.
1 parent f0499f0 commit 187959b

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.6.1
2+
3+
- Fix wrong trait constraint in ResultExt implementation (#66).
4+
15
# 0.6.0
26

37
- Conditional compilation for error variants.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "error-chain"
4-
version = "0.6.0"
4+
version = "0.6.1"
55
authors = [ "Brian Anderson <banderson@mozilla.com>",
66
"Paul Colomiets <paul@colomiets.name>",
77
"Colin Kiegel <kiegel@gmx.de>"]

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,11 @@ pub trait ResultExt<T, E, CE: ChainedError> {
389389
EK: Into<CE::ErrorKind>;
390390
}
391391

392-
impl<T, E, CE> ResultExt<T, E, CE> for Result<T, E> where CE: ChainedError, E: Into<CE> {
392+
impl<T, E, CE> ResultExt<T, E, CE> for Result<T, E> where CE: ChainedError, E: error::Error + Send + 'static {
393393
fn chain_err<F, EK>(self, callback: F) -> Result<T, CE>
394394
where F: FnOnce() -> EK,
395395
EK: Into<CE::ErrorKind> {
396396
self.map_err(move |e| {
397-
let e = e.into();
398397
#[cfg(feature = "backtrace")]
399398
let error = {
400399
let backtrace = CE::extract_backtrace(&e)

tests/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ fn chain_err() {
249249
}
250250

251251
let _: Result<()> = Err(fmt::Error).chain_err(|| "");
252-
let _: Result<()> = Err(ErrorKind::Test).chain_err(|| "");
252+
let _: Result<()> = Err(Error::from_kind(ErrorKind::Test)).chain_err(|| "");
253253
}
254254

255255
#[test]

0 commit comments

Comments
 (0)