aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--TODO.md1
-rw-r--r--src/util.rs3
3 files changed, 2 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e962e0..5466620 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@
- Remove the `CommandError::Undefined` variant.
- Add a private `PhantomData` field to `Pro` and `Storage` to make direct
instantiation impossible.
+- Prefer using the `Into` trait over numeric casting.
# v0.3.4 (2019-01-20)
- Fix authentication methods that assumed that `char` is signed.
diff --git a/TODO.md b/TODO.md
index 8f4e348..0467f1d 100644
--- a/TODO.md
+++ b/TODO.md
@@ -8,7 +8,6 @@
- Fix timing issues with the `totp_no_pin` and `totp_pin` test cases.
- Clear passwords from memory.
- Find a nicer syntax for the `write_config` test.
-- Check integer conversions.
- Consider implementing `Into<CommandError>` for `(Device, CommandError)`
- Lock password safe in `PasswordSafe::drop()` (see [nitrokey-storage-firmware
issue 65][]).
diff --git a/src/util.rs b/src/util.rs
index 79b8c34..2542a7b 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -59,8 +59,7 @@ pub fn get_command_result(value: c_int) -> Result<(), Error> {
}
pub fn get_last_result() -> Result<(), Error> {
- let value = unsafe { nitrokey_sys::NK_get_last_command_status() } as c_int;
- get_command_result(value)
+ get_command_result(unsafe { nitrokey_sys::NK_get_last_command_status() }.into())
}
pub fn get_last_error() -> Error {