From addc65933f1c63f9cfa33b0ec1c193f191a80c5f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jan 2026 10:45:51 +0100 Subject: [PATCH] Fmt happy in nightly --- wallet-ffi/src/account.rs | 12 +++++++----- wallet-ffi/src/keys.rs | 8 +++++--- wallet-ffi/src/lib.rs | 7 +++---- wallet-ffi/src/sync.rs | 10 ++++++---- wallet-ffi/src/transfer.rs | 13 +++++++------ wallet-ffi/src/wallet.rs | 25 +++++++++++++++---------- 6 files changed, 43 insertions(+), 32 deletions(-) diff --git a/wallet-ffi/src/account.rs b/wallet-ffi/src/account.rs index a058acc7..b99d10cf 100644 --- a/wallet-ffi/src/account.rs +++ b/wallet-ffi/src/account.rs @@ -4,12 +4,14 @@ use std::ptr; use nssa::AccountId; -use crate::block_on; -use crate::error::{print_error, WalletFfiError}; -use crate::types::{ - FfiAccount, FfiAccountList, FfiAccountListEntry, FfiBytes32, FfiProgramId, WalletHandle, +use crate::{ + block_on, + error::{print_error, WalletFfiError}, + types::{ + FfiAccount, FfiAccountList, FfiAccountListEntry, FfiBytes32, FfiProgramId, WalletHandle, + }, + wallet::get_wallet, }; -use crate::wallet::get_wallet; /// Create a new public account. /// diff --git a/wallet-ffi/src/keys.rs b/wallet-ffi/src/keys.rs index 27989c0e..e8309a81 100644 --- a/wallet-ffi/src/keys.rs +++ b/wallet-ffi/src/keys.rs @@ -4,9 +4,11 @@ use std::ptr; use nssa::{AccountId, PublicKey}; -use crate::error::{print_error, WalletFfiError}; -use crate::types::{FfiBytes32, FfiPrivateAccountKeys, FfiPublicAccountKey, WalletHandle}; -use crate::wallet::get_wallet; +use crate::{ + error::{print_error, WalletFfiError}, + types::{FfiBytes32, FfiPrivateAccountKeys, FfiPublicAccountKey, WalletHandle}, + wallet::get_wallet, +}; /// Get the public key for a public account. /// diff --git a/wallet-ffi/src/lib.rs b/wallet-ffi/src/lib.rs index 3058d8b5..75032300 100644 --- a/wallet-ffi/src/lib.rs +++ b/wallet-ffi/src/lib.rs @@ -28,14 +28,13 @@ pub mod transfer; pub mod types; pub mod wallet; -use tokio::runtime::Handle; - -use crate::error::{print_error, WalletFfiError}; - // Re-export public types for cbindgen pub use error::WalletFfiError as FfiError; +use tokio::runtime::Handle; pub use types::*; +use crate::error::{print_error, WalletFfiError}; + /// Get a reference to the global runtime. pub(crate) fn get_runtime() -> Result { Handle::try_current().map_err(|_| WalletFfiError::RuntimeError) diff --git a/wallet-ffi/src/sync.rs b/wallet-ffi/src/sync.rs index d1d7d560..3979f935 100644 --- a/wallet-ffi/src/sync.rs +++ b/wallet-ffi/src/sync.rs @@ -1,9 +1,11 @@ //! Block synchronization functions. -use crate::block_on; -use crate::error::{print_error, WalletFfiError}; -use crate::types::WalletHandle; -use crate::wallet::get_wallet; +use crate::{ + block_on, + error::{print_error, WalletFfiError}, + types::WalletHandle, + wallet::get_wallet, +}; /// Synchronize private accounts to a specific block. /// diff --git a/wallet-ffi/src/transfer.rs b/wallet-ffi/src/transfer.rs index c8357dcf..055f0c32 100644 --- a/wallet-ffi/src/transfer.rs +++ b/wallet-ffi/src/transfer.rs @@ -1,16 +1,17 @@ //! Token transfer functions. -use std::ffi::CString; -use std::ptr; +use std::{ffi::CString, ptr}; use common::error::ExecutionFailureKind; use nssa::AccountId; use wallet::program_facades::native_token_transfer::NativeTokenTransfer; -use crate::block_on; -use crate::error::{print_error, WalletFfiError}; -use crate::types::{FfiBytes32, FfiTransferResult, WalletHandle}; -use crate::wallet::get_wallet; +use crate::{ + block_on, + error::{print_error, WalletFfiError}, + types::{FfiBytes32, FfiTransferResult, WalletHandle}, + wallet::get_wallet, +}; /// Send a public token transfer. /// diff --git a/wallet-ffi/src/wallet.rs b/wallet-ffi/src/wallet.rs index 6c17d930..6f817f8e 100644 --- a/wallet-ffi/src/wallet.rs +++ b/wallet-ffi/src/wallet.rs @@ -1,15 +1,19 @@ //! Wallet lifecycle management functions. -use std::ffi::{c_char, CStr}; -use std::path::PathBuf; -use std::ptr; -use std::sync::Mutex; +use std::{ + ffi::{c_char, CStr}, + path::PathBuf, + ptr, + sync::Mutex, +}; use wallet::WalletCore; -use crate::block_on; -use crate::error::{print_error, WalletFfiError}; -use crate::types::WalletHandle; +use crate::{ + block_on, + error::{print_error, WalletFfiError}, + types::WalletHandle, +}; /// Internal wrapper around WalletCore with mutex for thread safety. pub(crate) struct WalletWrapper { @@ -172,8 +176,8 @@ pub unsafe extern "C" fn wallet_ffi_open( /// After calling this function, the handle is invalid and must not be used. /// /// # Safety -/// - The handle must be either null or a valid handle from `wallet_ffi_create_new()` -/// or `wallet_ffi_open()`. +/// - The handle must be either null or a valid handle from `wallet_ffi_create_new()` or +/// `wallet_ffi_open()`. /// - The handle must not be used after this call. #[no_mangle] pub unsafe extern "C" fn wallet_ffi_destroy(handle: *mut WalletHandle) { @@ -229,7 +233,8 @@ pub unsafe extern "C" fn wallet_ffi_save(handle: *mut WalletHandle) -> WalletFfi /// - `handle`: Valid wallet handle /// /// # Returns -/// - Pointer to null-terminated string on success (caller must free with `wallet_ffi_free_string()`) +/// - Pointer to null-terminated string on success (caller must free with +/// `wallet_ffi_free_string()`) /// - Null pointer on error /// /// # Safety