style: clippy fix

This commit is contained in:
LongYinan 2022-03-05 21:29:57 +08:00
parent 1104742983
commit b48a757837
7 changed files with 10 additions and 4 deletions

View file

@ -17,6 +17,7 @@ pub struct CallbackInfo<const N: usize> {
}
impl<const N: usize> CallbackInfo<N> {
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn new(
env: sys::napi_env,
callback_info: sys::napi_callback_info,

View file

@ -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<()> {
let error_status = format!("{:?}\0", self.0.status);
let status_len = error_status.len();

View file

@ -10,12 +10,12 @@ pub struct EscapableHandleScope<T: NapiRaw> {
}
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();
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();
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 {
handle_scope,

View file

@ -175,7 +175,7 @@ unsafe impl<T, ES: ErrorStrategy::T> Sync for 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)
/// for more information.
pub fn create<
pub(crate) fn create<
V: NapiRaw,
R: 'static + Send + FnMut(ThreadSafeCallContext<T>) -> Result<Vec<V>>,
>(

View file

@ -61,6 +61,7 @@ where
RT.0.spawn(fut);
}
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn execute_tokio_future<
Data: 'static + Send,
Fut: 'static + Send + Future<Output = Result<Data>>,

View file

@ -212,6 +212,7 @@ pub struct JsAssets {}
#[napi]
impl JsAssets {
#[napi(constructor)]
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
JsAssets {}
}
@ -228,6 +229,7 @@ pub struct JsAsset {}
#[napi]
impl JsAsset {
#[napi(constructor)]
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
Self {}
}

View file

@ -33,6 +33,7 @@ mod xxh3 {
#[napi]
impl Xxh3 {
#[napi(constructor)]
#[allow(clippy::new_without_default)]
pub fn new() -> Xxh3 {
Xxh3 {
inner: BigInt {