Skip to content

Commit

Permalink
Fix clippy lints in mullvad-api
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Nov 26, 2024
1 parent 126c6bc commit 9dde814
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mullvad-api/src/ffi/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub extern "C" fn mullvad_api_device_iter_next(
// SAFETY: Assuming device pointer is valid
unsafe { ptr::write(device_ptr, device.into()) }

return true;
true
}

#[no_mangle]
Expand Down
16 changes: 8 additions & 8 deletions mullvad-api/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl FfiClient {
/// * `hostname`: pointer to a null-terminated UTF-8 string representing the hostname that will be
/// used for TLS validation.
#[no_mangle]
pub extern "C" fn mullvad_api_client_initialize(
pub unsafe extern "C" fn mullvad_api_client_initialize(
client_ptr: *mut MullvadApiClient,
api_address_ptr: *const libc::c_char,
hostname: *const libc::c_char,
Expand All @@ -258,7 +258,7 @@ pub extern "C" fn mullvad_api_client_initialize(
/// * `account_str_ptr`: pointer to nul-terminated UTF-8 string containing the account number of the
/// account that will have all of it's devices removed.
#[no_mangle]
pub extern "C" fn mullvad_api_remove_all_devices(
pub unsafe extern "C" fn mullvad_api_remove_all_devices(
client_ptr: MullvadApiClient,
account_ptr: *const libc::c_char,
) -> MullvadApiError {
Expand All @@ -280,7 +280,7 @@ pub extern "C" fn mullvad_api_remove_all_devices(
/// * `expiry_unix_timestamp`: a pointer to a signed 64 bit integer. If this function returns no
/// error, the expiry timestamp will be written to this pointer.
#[no_mangle]
pub extern "C" fn mullvad_api_get_expiry(
pub unsafe extern "C" fn mullvad_api_get_expiry(
client_ptr: MullvadApiClient,
account_str_ptr: *const libc::c_char,
expiry_unix_timestamp: *mut i64,
Expand All @@ -307,7 +307,7 @@ pub extern "C" fn mullvad_api_get_expiry(
/// doesn't return an error, the pointer will be initialized with a valid instance of
/// `device::MullvadApiDeviceIterator`, which can be used to iterate through the devices.
#[no_mangle]
pub extern "C" fn mullvad_api_list_devices(
pub unsafe extern "C" fn mullvad_api_list_devices(
client_ptr: MullvadApiClient,
account_str_ptr: *const libc::c_char,
device_iter_ptr: *mut device::MullvadApiDeviceIterator,
Expand Down Expand Up @@ -336,7 +336,7 @@ pub extern "C" fn mullvad_api_list_devices(
/// * `new_device_ptr`: a pointer to enough memory to allocate a `MullvadApiDevice`. If this
/// function doesn't return an error, it will be initialized.
#[no_mangle]
pub extern "C" fn mullvad_api_add_device(
pub unsafe extern "C" fn mullvad_api_add_device(
client_ptr: MullvadApiClient,
account_str_ptr: *const libc::c_char,
public_key_ptr: *const u8,
Expand Down Expand Up @@ -366,7 +366,7 @@ pub extern "C" fn mullvad_api_add_device(
/// account number will be written to this pointer. It must be freed via
/// `mullvad_api_cstring_drop`.
#[no_mangle]
pub extern "C" fn mullvad_api_create_account(
pub unsafe extern "C" fn mullvad_api_create_account(
client_ptr: MullvadApiClient,
account_str_ptr: *mut *const libc::c_char,
) -> MullvadApiError {
Expand Down Expand Up @@ -394,7 +394,7 @@ pub extern "C" fn mullvad_api_create_account(
///
/// * `account_str_ptr`: A null-terminated string representing the account to be deleted.
#[no_mangle]
pub extern "C" fn mullvad_api_delete_account(
pub unsafe extern "C" fn mullvad_api_delete_account(
client_ptr: MullvadApiClient,
account_str_ptr: *const libc::c_char,
) -> MullvadApiError {
Expand All @@ -412,7 +412,7 @@ pub extern "C" fn mullvad_api_client_drop(client: MullvadApiClient) {

/// Deallocates a CString returned by the Mullvad API client.
#[no_mangle]
pub extern "C" fn mullvad_api_cstring_drop(cstr_ptr: *mut libc::c_char) {
pub unsafe extern "C" fn mullvad_api_cstring_drop(cstr_ptr: *mut libc::c_char) {
let _ = unsafe { CString::from_raw(cstr_ptr) };
}

Expand Down

0 comments on commit 9dde814

Please sign in to comment.