aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parent3810761847717676d91900c422d9c8b634f56d77 (diff)
parent1d36e2e1195fc9046e36f38dfe943198027e84ca (diff)
downloadnitrokey-rs-master.tar.gz
nitrokey-rs-master.tar.bz2
Merge branch 'release-v0.7.1'HEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/error.rs16
-rw-r--r--src/util.rs2
2 files changed, 2 insertions, 16 deletions
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 {