diff --git a/napi/src/async_work.rs b/napi/src/async_work.rs index d65fdf7f..bf5810fb 100644 --- a/napi/src/async_work.rs +++ b/napi/src/async_work.rs @@ -80,30 +80,14 @@ unsafe extern "C" fn complete( let output = ptr::read(v as *const _); work.inner_task.resolve(&mut env, output) }); - let mut handle_scope = ptr::null_mut(); match check_status(status).and_then(move |_| value) { Ok(v) => { - let open_handle_status = sys::napi_open_handle_scope(env, &mut handle_scope); - debug_assert!( - open_handle_status == sys::napi_status::napi_ok, - "OpenHandleScope failed" - ); let status = sys::napi_resolve_deferred(env, deferred, v.raw_value()); debug_assert!(status == sys::napi_status::napi_ok, "Reject promise failed"); } Err(e) => { - let open_handle_status = sys::napi_open_handle_scope(env, &mut handle_scope); - debug_assert!( - open_handle_status == sys::napi_status::napi_ok, - "OpenHandleScope failed" - ); let status = sys::napi_reject_deferred(env, deferred, e.into_raw(env)); debug_assert!(status == sys::napi_status::napi_ok, "Reject promise failed"); } }; - let close_handle_scope_status = sys::napi_close_handle_scope(env, handle_scope); - debug_assert!( - close_handle_scope_status == sys::napi_status::napi_ok, - "Close handle scope failed" - ); } diff --git a/napi/src/env.rs b/napi/src/env.rs index c470bb68..1ceaed1e 100644 --- a/napi/src/env.rs +++ b/napi/src/env.rs @@ -40,8 +40,7 @@ impl Env { pub fn get_undefined(&self) -> Result { let mut raw_value = ptr::null_mut(); - let status = unsafe { sys::napi_get_undefined(self.0, &mut raw_value) }; - check_status(status)?; + check_status(unsafe { sys::napi_get_undefined(self.0, &mut raw_value) })?; Ok(JsUndefined::from_raw_unchecked(self.0, raw_value)) }