From 601bc22ae18838ff56b64c15b365bcf7f93006be Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 23 Jan 2019 02:44:20 +0000 Subject: 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. --- src/util.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') 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 { -- cgit v1.2.1