style: clippy fix
This commit is contained in:
parent
1104742983
commit
b48a757837
7 changed files with 10 additions and 4 deletions
|
@ -17,6 +17,7 @@ pub struct CallbackInfo<const N: usize> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> CallbackInfo<N> {
|
impl<const N: usize> CallbackInfo<N> {
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
env: sys::napi_env,
|
env: sys::napi_env,
|
||||||
callback_info: sys::napi_callback_info,
|
callback_info: sys::napi_callback_info,
|
||||||
|
|
|
@ -213,6 +213,7 @@ macro_rules! impl_object_methods {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub fn throw(&self, env: sys::napi_env) -> Result<()> {
|
pub fn throw(&self, env: sys::napi_env) -> Result<()> {
|
||||||
let error_status = format!("{:?}\0", self.0.status);
|
let error_status = format!("{:?}\0", self.0.status);
|
||||||
let status_len = error_status.len();
|
let status_len = error_status.len();
|
||||||
|
|
|
@ -10,12 +10,12 @@ pub struct EscapableHandleScope<T: NapiRaw> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: NapiRaw> EscapableHandleScope<T> {
|
impl<T: NapiRaw> EscapableHandleScope<T> {
|
||||||
pub fn open(env: sys::napi_env, value: T) -> Result<Self> {
|
pub fn open(env: Env, value: T) -> Result<Self> {
|
||||||
let mut handle_scope = ptr::null_mut();
|
let mut handle_scope = ptr::null_mut();
|
||||||
check_status!(unsafe { sys::napi_open_escapable_handle_scope(env, &mut handle_scope) })?;
|
check_status!(unsafe { sys::napi_open_escapable_handle_scope(env.0, &mut handle_scope) })?;
|
||||||
let mut result = ptr::null_mut();
|
let mut result = ptr::null_mut();
|
||||||
check_status!(unsafe {
|
check_status!(unsafe {
|
||||||
sys::napi_escape_handle(env, handle_scope, NapiRaw::raw(&value), &mut result)
|
sys::napi_escape_handle(env.0, handle_scope, NapiRaw::raw(&value), &mut result)
|
||||||
})?;
|
})?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
handle_scope,
|
handle_scope,
|
||||||
|
|
|
@ -175,7 +175,7 @@ unsafe impl<T, ES: ErrorStrategy::T> Sync for ThreadsafeFunction<T, ES> {}
|
||||||
impl<T: 'static, ES: ErrorStrategy::T> ThreadsafeFunction<T, ES> {
|
impl<T: 'static, ES: ErrorStrategy::T> ThreadsafeFunction<T, ES> {
|
||||||
/// See [napi_create_threadsafe_function](https://nodejs.org/api/n-api.html#n_api_napi_create_threadsafe_function)
|
/// See [napi_create_threadsafe_function](https://nodejs.org/api/n-api.html#n_api_napi_create_threadsafe_function)
|
||||||
/// for more information.
|
/// for more information.
|
||||||
pub fn create<
|
pub(crate) fn create<
|
||||||
V: NapiRaw,
|
V: NapiRaw,
|
||||||
R: 'static + Send + FnMut(ThreadSafeCallContext<T>) -> Result<Vec<V>>,
|
R: 'static + Send + FnMut(ThreadSafeCallContext<T>) -> Result<Vec<V>>,
|
||||||
>(
|
>(
|
||||||
|
|
|
@ -61,6 +61,7 @@ where
|
||||||
RT.0.spawn(fut);
|
RT.0.spawn(fut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub fn execute_tokio_future<
|
pub fn execute_tokio_future<
|
||||||
Data: 'static + Send,
|
Data: 'static + Send,
|
||||||
Fut: 'static + Send + Future<Output = Result<Data>>,
|
Fut: 'static + Send + Future<Output = Result<Data>>,
|
||||||
|
|
|
@ -212,6 +212,7 @@ pub struct JsAssets {}
|
||||||
#[napi]
|
#[napi]
|
||||||
impl JsAssets {
|
impl JsAssets {
|
||||||
#[napi(constructor)]
|
#[napi(constructor)]
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
JsAssets {}
|
JsAssets {}
|
||||||
}
|
}
|
||||||
|
@ -228,6 +229,7 @@ pub struct JsAsset {}
|
||||||
#[napi]
|
#[napi]
|
||||||
impl JsAsset {
|
impl JsAsset {
|
||||||
#[napi(constructor)]
|
#[napi(constructor)]
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {}
|
Self {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ mod xxh3 {
|
||||||
#[napi]
|
#[napi]
|
||||||
impl Xxh3 {
|
impl Xxh3 {
|
||||||
#[napi(constructor)]
|
#[napi(constructor)]
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Xxh3 {
|
pub fn new() -> Xxh3 {
|
||||||
Xxh3 {
|
Xxh3 {
|
||||||
inner: BigInt {
|
inner: BigInt {
|
||||||
|
|
Loading…
Reference in a new issue