Skip to content

Commit

Permalink
cargo fmt --all
Browse files Browse the repository at this point in the history
  • Loading branch information
dherman committed Nov 22, 2024
1 parent 2388227 commit 8125e15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
7 changes: 1 addition & 6 deletions crates/neon/src/sys/no_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,7 @@ extern "C" fn finalize_panic(_env: Env, data: *mut c_void, _hint: *mut c_void) {
unsafe fn create_string(env: Env, msg: &str) -> Local {
let mut string = MaybeUninit::uninit();

if napi::create_string_utf8(
env,
msg.as_ptr().cast(),
msg.len(),
string.as_mut_ptr(),
).is_err() {
if napi::create_string_utf8(env, msg.as_ptr().cast(), msg.len(), string.as_mut_ptr()).is_err() {
fatal_error("Failed to create a String");
}

Expand Down
18 changes: 5 additions & 13 deletions crates/neon/src/sys/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ pub unsafe fn get_own_property_names(out: &mut Local, env: Env, object: Local) -
napi::KeyFilter::ALL_PROPERTIES | napi::KeyFilter::SKIP_SYMBOLS,
napi::KeyConversion::NumbersToStrings,
property_names.as_mut_ptr(),
).is_err() {
)
.is_err()
{
return false;
}

Expand Down Expand Up @@ -80,12 +82,7 @@ pub unsafe fn get_string(

// Not using `crate::string::new()` because it requires a _reference_ to a Local,
// while we only have uninitialized memory.
if napi::create_string_utf8(
env,
key as *const _,
len as usize,
key_val.as_mut_ptr(),
).is_err() {
if napi::create_string_utf8(env, key as *const _, len as usize, key_val.as_mut_ptr()).is_err() {
return false;
}

Expand Down Expand Up @@ -115,12 +112,7 @@ pub unsafe fn set_string(

*out = true;

if napi::create_string_utf8(
env,
key as *const _,
len as usize,
key_val.as_mut_ptr(),
).is_err() {
if napi::create_string_utf8(env, key as *const _, len as usize, key_val.as_mut_ptr()).is_err() {
*out = false;
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion crates/neon/src/sys/tsfn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ impl<T> Drop for ThreadsafeFunction<T> {
assert!(napi::release_threadsafe_function(
self.tsfn.0,
napi::ThreadsafeFunctionReleaseMode::Release,
).is_ok());
)
.is_ok());
};
}
}

0 comments on commit 8125e15

Please sign in to comment.