diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2020-08-30 18:52:15 +0200 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2020-08-30 18:52:15 +0200 |
commit | b2607cbd3f239be9d09204921db278424cc7a6be (patch) | |
tree | b5e41756cbae69f91cfb91db5b42eeecab35d302 | |
parent | e9a89be939acf22cf17e3d6bc505a968a98d3dee (diff) | |
download | nitrokey-rs-b2607cbd3f239be9d09204921db278424cc7a6be.tar.gz nitrokey-rs-b2607cbd3f239be9d09204921db278424cc7a6be.tar.bz2 |
Use map_err(|_| x) instead of or_else(|_| Err(x))
-rw-r--r-- | src/util.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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 { |