From 3f402dc13530ce4de167bae843200cfbd72ed69b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 8 Jul 2020 22:22:10 +0200 Subject: Remove Error::RandError variant Since we update rand_os to version 0.2 in commit 6c138eaa850c745b97b7e48a201db0cbaad8e1e0, the random number generation can no longer fail. Therefore the Error::RandError variant is no longer needed. As we did not want to break the public API, we still kept the RandError variant. This patch removes the RandError variant for good. --- CHANGELOG.md | 1 + src/error.rs | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dddccb1..651a50e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ SPDX-License-Identifier: CC0-1.0 # Unreleased - Refactor the `Error` enum so that it is `Send`, `Sync` and `'static`: - Remove the `sync::PoisonError` from the `PoisonError` variant. + - Remove `Error::RandError` variant. # v0.6.0 (2020-02-03) - Add `String` value to the `Error::UnexpectedError` variant. diff --git a/src/error.rs b/src/error.rs index e0698a2..995741b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -22,8 +22,6 @@ pub enum Error { LibraryError(LibraryError), /// An error that occurred due to a poisoned lock. PoisonError, - /// An error that occurred during random number generation. - RandError(Box), /// An error that is caused by an unexpected value returned by libnitrokey. UnexpectedError(String), /// An unknown error returned by libnitrokey. @@ -101,7 +99,6 @@ impl error::Error for Error { Error::ConcurrentAccessError => None, Error::LibraryError(ref err) => Some(err), Error::PoisonError => None, - Error::RandError(ref err) => Some(err.as_ref()), Error::UnexpectedError(_) => None, Error::UnknownError(_) => None, Error::UnsupportedModelError => None, @@ -118,7 +115,6 @@ impl fmt::Display for Error { Error::ConcurrentAccessError => write!(f, "Internal error: concurrent access"), Error::LibraryError(ref err) => write!(f, "Library error: {}", err), Error::PoisonError => write!(f, "Internal error: poisoned lock"), - Error::RandError(ref err) => write!(f, "RNG error: {}", err), Error::UnexpectedError(ref s) => write!(f, "An unexpected error occurred: {}", s), Error::UnknownError(ref err) => write!(f, "Unknown error: {}", err), Error::UnsupportedModelError => write!(f, "Unsupported Nitrokey model"), -- cgit v1.2.1