summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-23 02:44:20 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-01-23 03:51:37 +0100
commit601bc22ae18838ff56b64c15b365bcf7f93006be (patch)
tree3a20a71c90746c4db9c0d96820870bd72e60b9dc /src
parent57e3c6bf010d51842cbc86a9801fd9baee1b22eb (diff)
downloadnitrokey-rs-601bc22ae18838ff56b64c15b365bcf7f93006be.tar.gz
nitrokey-rs-601bc22ae18838ff56b64c15b365bcf7f93006be.tar.bz2
Prefer into() over numeric casting
Numeric casting might truncate an integer, while into() is only implemented for numeric types if the cast is possible without truncation.
Diffstat (limited to 'src')
-rw-r--r--src/util.rs3
1 files changed, 1 insertions, 2 deletions
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 {