diff --git a/crates/napi/src/bindgen_runtime/callback_info.rs b/crates/napi/src/bindgen_runtime/callback_info.rs index 43c8593c..13e9468f 100644 --- a/crates/napi/src/bindgen_runtime/callback_info.rs +++ b/crates/napi/src/bindgen_runtime/callback_info.rs @@ -4,12 +4,12 @@ use std::ptr; use std::rc::Rc; use std::sync::atomic::{AtomicBool, Ordering}; -use crate::{bindgen_prelude::*, check_status, sys, Result}; +use crate::{bindgen_prelude::*, check_status}; thread_local! { #[doc(hidden)] /// 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)] diff --git a/crates/napi/src/bindgen_runtime/js_values/array.rs b/crates/napi/src/bindgen_runtime/js_values/array.rs index d47ae411..393ffc1f 100644 --- a/crates/napi/src/bindgen_runtime/js_values/array.rs +++ b/crates/napi/src/bindgen_runtime/js_values/array.rs @@ -1,6 +1,6 @@ use std::ptr; -use crate::{bindgen_prelude::*, check_status, sys, JsObject, Value, ValueType}; +use crate::{bindgen_prelude::*, check_status, JsObject, Value}; pub struct Array { env: sys::napi_env, diff --git a/crates/napi/src/bindgen_runtime/js_values/value_ref.rs b/crates/napi/src/bindgen_runtime/js_values/value_ref.rs index 9ab7db42..fa0444b4 100644 --- a/crates/napi/src/bindgen_runtime/js_values/value_ref.rs +++ b/crates/napi/src/bindgen_runtime/js_values/value_ref.rs @@ -81,7 +81,7 @@ impl Reference { let finalize_callbacks_raw = unsafe { Rc::from_raw(finalize_callbacks_ptr) }; let finalize_callbacks = finalize_callbacks_raw.clone(); // Leak the raw finalize callbacks - Rc::into_raw(finalize_callbacks_raw); + let _ = Rc::into_raw(finalize_callbacks_raw); Ok(Self { raw: wrapped_value.cast(), napi_ref, diff --git a/crates/napi/src/lib.rs b/crates/napi/src/lib.rs index 67fb2e7e..4b1138ab 100644 --- a/crates/napi/src/lib.rs +++ b/crates/napi/src/lib.rs @@ -1,5 +1,4 @@ #![deny(clippy::all)] -#![forbid(unsafe_op_in_unsafe_fn)] #![allow(non_upper_case_globals)] //! High level Node.js [N-API](https://nodejs.org/api/n-api.html) binding diff --git a/crates/napi/src/threadsafe_function.rs b/crates/napi/src/threadsafe_function.rs index c16e9097..dfe2b05e 100644 --- a/crates/napi/src/threadsafe_function.rs +++ b/crates/napi/src/threadsafe_function.rs @@ -1,6 +1,5 @@ #![allow(clippy::single_component_path_imports)] -use std::convert::Into; use std::marker::PhantomData; use std::os::raw::c_void; use std::ptr::{self, null_mut}; diff --git a/crates/napi/src/version.rs b/crates/napi/src/version.rs index 7a24ebca..09f74cc9 100644 --- a/crates/napi/src/version.rs +++ b/crates/napi/src/version.rs @@ -1,5 +1,4 @@ use crate::{sys, Error, Status}; -use std::convert::TryFrom; use std::ffi::CStr; #[derive(Debug, Clone, Copy)] diff --git a/examples/napi/src/async.rs b/examples/napi/src/async.rs index dde847fc..29a586d6 100644 --- a/examples/napi/src/async.rs +++ b/examples/napi/src/async.rs @@ -1,7 +1,6 @@ #[cfg(not(target_family = "wasm"))] use futures::prelude::*; use napi::bindgen_prelude::*; -use napi::tokio; #[cfg(not(target_family = "wasm"))] use napi::tokio::fs; diff --git a/examples/napi/src/env.rs b/examples/napi/src/env.rs index cb153424..765e835f 100644 --- a/examples/napi/src/env.rs +++ b/examples/napi/src/env.rs @@ -1,4 +1,4 @@ -use napi::{bindgen_prelude::*, Env}; +use napi::bindgen_prelude::*; #[napi] pub fn run_script(env: Env, script: String) -> Result { diff --git a/examples/napi/src/object.rs b/examples/napi/src/object.rs index 4f85284f..5363065d 100644 --- a/examples/napi/src/object.rs +++ b/examples/napi/src/object.rs @@ -1,6 +1,6 @@ use napi::{ bindgen_prelude::*, threadsafe_function::ThreadsafeFunction, JsGlobal, JsNull, JsObject, - JsUndefined, Property, + JsUndefined, }; #[napi] diff --git a/examples/napi/src/symbol.rs b/examples/napi/src/symbol.rs index 3a06425a..66e7ddb2 100644 --- a/examples/napi/src/symbol.rs +++ b/examples/napi/src/symbol.rs @@ -1,4 +1,4 @@ -use napi::{bindgen_prelude::*, Env, JsObject, JsSymbol}; +use napi::{bindgen_prelude::*, JsObject, JsSymbol}; #[napi] pub fn set_symbol_in_obj(env: Env, symbol: JsSymbol) -> Result {