aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-08-30 19:09:17 +0200
committerRobin Krahl <robin.krahl@ireas.org>2020-08-30 19:09:17 +0200
commit21de2b96335b3cfcaea9b96592fe5eef34f81126 (patch)
tree1d2b82d3e8be6d86890d5292ac02cb6e54605252
parent3810761847717676d91900c422d9c8b634f56d77 (diff)
parent1d36e2e1195fc9046e36f38dfe943198027e84ca (diff)
downloadnitrokey-rs-21de2b96335b3cfcaea9b96592fe5eef34f81126.tar.gz
nitrokey-rs-21de2b96335b3cfcaea9b96592fe5eef34f81126.tar.bz2
Merge branch 'release-v0.7.1'HEADmaster
-rw-r--r--CHANGELOG.md4
-rw-r--r--Cargo.toml2
-rw-r--r--src/error.rs16
-rw-r--r--src/util.rs2
4 files changed, 7 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 736620d..121d0a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,10 @@ Copyright (C) 2019-2020 Robin Krahl <robin.krahl@ireas.org>
SPDX-License-Identifier: CC0-1.0
-->
+# v0.7.1 (2020-08-30)
+- Remove the custom `std::error::Error::source` implementation for
+ `error::Error` to avoid duplicate error messages.
+
# v0.7.0 (2020-07-14)
- Refactor the `Error` enum so that it is `Send`, `Sync` and `'static`:
- Remove the `sync::PoisonError` from the `PoisonError` variant.
diff --git a/Cargo.toml b/Cargo.toml
index 00c41ce..6eb52eb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@
[package]
name = "nitrokey"
-version = "0.7.0"
+version = "0.7.1"
authors = ["Robin Krahl <robin.krahl@ireas.org>"]
edition = "2018"
homepage = "https://code.ireas.org/nitrokey-rs/"
diff --git a/src/error.rs b/src/error.rs
index 1aa1793..64a2ce0 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -91,21 +91,7 @@ impl<'a, T: device::Device<'a>> From<(T, Error)> for Error {
}
}
-impl error::Error for Error {
- fn source(&self) -> Option<&(dyn error::Error + 'static)> {
- match *self {
- Error::CommandError(ref err) => Some(err),
- Error::CommunicationError(ref err) => Some(err),
- Error::ConcurrentAccessError => None,
- Error::LibraryError(ref err) => Some(err),
- Error::PoisonError => None,
- Error::UnexpectedError(_) => None,
- Error::UnknownError(_) => None,
- Error::UnsupportedModelError => None,
- Error::Utf8Error(ref err) => Some(err),
- }
- }
-}
+impl error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
diff --git a/src/util.rs b/src/util.rs
index b17b071..26942cf 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -99,7 +99,7 @@ pub fn generate_password(length: usize) -> Result<CString, Error> {
}
pub fn get_cstring<T: Into<Vec<u8>>>(s: T) -> Result<CString, Error> {
- CString::new(s).or_else(|_| Err(LibraryError::InvalidString.into()))
+ CString::new(s).map_err(|_| LibraryError::InvalidString.into())
}
impl Into<i32> for LogLevel {