aboutsummaryrefslogtreecommitdiff
path: root/src/otp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/otp.rs')
-rw-r--r--src/otp.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/otp.rs b/src/otp.rs
index 7535a77..430b127 100644
--- a/src/otp.rs
+++ b/src/otp.rs
@@ -219,7 +219,7 @@ pub trait GenerateOtp {
/// [`InvalidSlot`]: enum.LibraryError.html#variant.InvalidSlot
/// [`SlotNotProgrammed`]: enum.CommandError.html#variant.SlotNotProgrammed
fn get_hotp_slot_name(&self, slot: u8) -> Result<String, Error> {
- unsafe { result_from_string(nitrokey_sys::NK_get_hotp_slot_name(slot)) }
+ result_from_string(unsafe { nitrokey_sys::NK_get_hotp_slot_name(slot) })
}
/// Returns the name of the given TOTP slot.
@@ -248,7 +248,7 @@ pub trait GenerateOtp {
/// [`InvalidSlot`]: enum.LibraryError.html#variant.InvalidSlot
/// [`SlotNotProgrammed`]: enum.CommandError.html#variant.SlotNotProgrammed
fn get_totp_slot_name(&self, slot: u8) -> Result<String, Error> {
- unsafe { result_from_string(nitrokey_sys::NK_get_totp_slot_name(slot)) }
+ result_from_string(unsafe { nitrokey_sys::NK_get_totp_slot_name(slot) })
}
/// Generates an HOTP code on the given slot. This operation may require user authorization,
@@ -279,9 +279,7 @@ pub trait GenerateOtp {
/// [`NotAuthorized`]: enum.CommandError.html#variant.NotAuthorized
/// [`SlotNotProgrammed`]: enum.CommandError.html#variant.SlotNotProgrammed
fn get_hotp_code(&self, slot: u8) -> Result<String, Error> {
- unsafe {
- return result_from_string(nitrokey_sys::NK_get_hotp_code(slot));
- }
+ result_from_string(unsafe { nitrokey_sys::NK_get_hotp_code(slot) })
}
/// Generates a TOTP code on the given slot. This operation may require user authorization,
@@ -324,9 +322,7 @@ pub trait GenerateOtp {
/// [`NotAuthorized`]: enum.CommandError.html#variant.NotAuthorized
/// [`SlotNotProgrammed`]: enum.CommandError.html#variant.SlotNotProgrammed
fn get_totp_code(&self, slot: u8) -> Result<String, Error> {
- unsafe {
- return result_from_string(nitrokey_sys::NK_get_totp_code(slot, 0, 0, 0));
- }
+ result_from_string(unsafe { nitrokey_sys::NK_get_totp_code(slot, 0, 0, 0) })
}
}