From c5c8d175611802ec86d65ad81886467dab09a609 Mon Sep 17 00:00:00 2001 From: Justin Baur <19896123+justindbaur@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:15:20 -0400 Subject: [PATCH] Formatting --- crates/bitwarden-c/src/c.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/crates/bitwarden-c/src/c.rs b/crates/bitwarden-c/src/c.rs index 3ce2add63..e0f185f04 100644 --- a/crates/bitwarden-c/src/c.rs +++ b/crates/bitwarden-c/src/c.rs @@ -34,7 +34,7 @@ type OnCompletedCallback = unsafe extern "C" fn(result: *mut c_char) -> (); pub extern "C" fn run_command_async( c_str_ptr: *const c_char, client_ptr: *const CClient, - on_completed_callback: OnCompletedCallback + on_completed_callback: OnCompletedCallback, ) -> () { let client = unsafe { ffi_ref!(client_ptr) }; let input_str = str::from_utf8(unsafe { CStr::from_ptr(c_str_ptr) }.to_bytes()) @@ -44,18 +44,16 @@ pub extern "C" fn run_command_async( // so we need to make our own copy. .to_owned(); - client - .runtime - .spawn(async move { - let result = client.client.run_command(input_str.as_str()).await; - let str_result = match std::ffi::CString::new(result) { - Ok(cstr) => cstr.into_raw(), - Err(_) => panic!("failed to return comment result: null encountered"), - }; + client.runtime.spawn(async move { + let result = client.client.run_command(input_str.as_str()).await; + let str_result = match std::ffi::CString::new(result) { + Ok(cstr) => cstr.into_raw(), + Err(_) => panic!("failed to return comment result: null encountered"), + }; - // run completed function - unsafe { on_completed_callback(str_result) } - }); + // run completed function + unsafe { on_completed_callback(str_result) } + }); } // Init client, potential leak! You need to call free_mem after this!