style: clippy fix (#2012)

This commit is contained in:
LongYinan 2024-03-23 19:35:58 +08:00 committed by GitHub
parent 15521fb90f
commit be610c9353
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 7 additions and 11 deletions

View file

@ -4,12 +4,12 @@ use std::ptr;
use std::rc::Rc; use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use crate::{bindgen_prelude::*, check_status, sys, Result}; use crate::{bindgen_prelude::*, check_status};
thread_local! { thread_local! {
#[doc(hidden)] #[doc(hidden)]
/// Determined is `constructor` called from Class `factory` /// Determined is `constructor` called from Class `factory`
pub static ___CALL_FROM_FACTORY: AtomicBool = AtomicBool::new(false); pub static ___CALL_FROM_FACTORY: AtomicBool = const { AtomicBool::new(false) };
} }
#[repr(transparent)] #[repr(transparent)]

View file

@ -1,6 +1,6 @@
use std::ptr; use std::ptr;
use crate::{bindgen_prelude::*, check_status, sys, JsObject, Value, ValueType}; use crate::{bindgen_prelude::*, check_status, JsObject, Value};
pub struct Array { pub struct Array {
env: sys::napi_env, env: sys::napi_env,

View file

@ -81,7 +81,7 @@ impl<T: 'static> Reference<T> {
let finalize_callbacks_raw = unsafe { Rc::from_raw(finalize_callbacks_ptr) }; let finalize_callbacks_raw = unsafe { Rc::from_raw(finalize_callbacks_ptr) };
let finalize_callbacks = finalize_callbacks_raw.clone(); let finalize_callbacks = finalize_callbacks_raw.clone();
// Leak the raw finalize callbacks // Leak the raw finalize callbacks
Rc::into_raw(finalize_callbacks_raw); let _ = Rc::into_raw(finalize_callbacks_raw);
Ok(Self { Ok(Self {
raw: wrapped_value.cast(), raw: wrapped_value.cast(),
napi_ref, napi_ref,

View file

@ -1,5 +1,4 @@
#![deny(clippy::all)] #![deny(clippy::all)]
#![forbid(unsafe_op_in_unsafe_fn)]
#![allow(non_upper_case_globals)] #![allow(non_upper_case_globals)]
//! High level Node.js [N-API](https://nodejs.org/api/n-api.html) binding //! High level Node.js [N-API](https://nodejs.org/api/n-api.html) binding

View file

@ -1,6 +1,5 @@
#![allow(clippy::single_component_path_imports)] #![allow(clippy::single_component_path_imports)]
use std::convert::Into;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::os::raw::c_void; use std::os::raw::c_void;
use std::ptr::{self, null_mut}; use std::ptr::{self, null_mut};

View file

@ -1,5 +1,4 @@
use crate::{sys, Error, Status}; use crate::{sys, Error, Status};
use std::convert::TryFrom;
use std::ffi::CStr; use std::ffi::CStr;
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]

View file

@ -1,7 +1,6 @@
#[cfg(not(target_family = "wasm"))] #[cfg(not(target_family = "wasm"))]
use futures::prelude::*; use futures::prelude::*;
use napi::bindgen_prelude::*; use napi::bindgen_prelude::*;
use napi::tokio;
#[cfg(not(target_family = "wasm"))] #[cfg(not(target_family = "wasm"))]
use napi::tokio::fs; use napi::tokio::fs;

View file

@ -1,4 +1,4 @@
use napi::{bindgen_prelude::*, Env}; use napi::bindgen_prelude::*;
#[napi] #[napi]
pub fn run_script(env: Env, script: String) -> Result<Unknown> { pub fn run_script(env: Env, script: String) -> Result<Unknown> {

View file

@ -1,6 +1,6 @@
use napi::{ use napi::{
bindgen_prelude::*, threadsafe_function::ThreadsafeFunction, JsGlobal, JsNull, JsObject, bindgen_prelude::*, threadsafe_function::ThreadsafeFunction, JsGlobal, JsNull, JsObject,
JsUndefined, Property, JsUndefined,
}; };
#[napi] #[napi]

View file

@ -1,4 +1,4 @@
use napi::{bindgen_prelude::*, Env, JsObject, JsSymbol}; use napi::{bindgen_prelude::*, JsObject, JsSymbol};
#[napi] #[napi]
pub fn set_symbol_in_obj(env: Env, symbol: JsSymbol) -> Result<JsObject> { pub fn set_symbol_in_obj(env: Env, symbol: JsSymbol) -> Result<JsObject> {