Skip to content

Commit 32a2cde

Browse files
author
Rouven Spreckels
committed
Update err-derive.
1 parent 11b0ed9 commit 32a2cde

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "signifix"
33
version = "0.10.0"
4+
edition = "2018"
45
authors = [
56
"Rouven Spreckels <[email protected]>",
67
]
@@ -34,4 +35,4 @@ include = [
3435
travis-ci = { repository = "qu1x/signifix" }
3536

3637
[dependencies]
37-
err-derive = "0.1"
38+
err-derive = "0.2"

src/binary.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
// DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
88

9+
use err_derive::Error;
10+
911
use std::convert::TryFrom;
1012

1113
use std::result;

src/lib.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@
369369
370370
#![deny(missing_docs)]
371371

372-
#[macro_use]
373-
extern crate err_derive;
372+
use err_derive::Error;
374373

375374
use std::result;
376375

@@ -451,23 +450,11 @@ pub mod binary;
451450
pub enum Error {
452451
/// A given number is not representable with any metric prefix.
453452
#[error(display = "Not representable with any metric prefix")]
454-
Metric(#[cause] metric::Error),
453+
Metric(#[source] metric::Error),
455454

456455
/// A given number is not representable with any binary prefix.
457456
#[error(display = "Not representable with any binary prefix")]
458-
Binary(#[cause] binary::Error),
459-
}
460-
461-
impl From<metric::Error> for Error {
462-
fn from(error: metric::Error) -> Self {
463-
Error::Metric(error)
464-
}
465-
}
466-
467-
impl From<binary::Error> for Error {
468-
fn from(error: binary::Error) -> Self {
469-
Error::Binary(error)
470-
}
457+
Binary(#[source] binary::Error),
471458
}
472459

473460
/// The canonical `Result` type using this crate's `Error` type.

src/metric.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
// DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
88

9+
use err_derive::Error;
10+
911
use std::convert::TryFrom;
1012

1113
use std::result;

0 commit comments

Comments
 (0)