style(napi): fix compile warning (#1785)
This commit is contained in:
parent
feabcd7f16
commit
1e5c32ca60
5 changed files with 17 additions and 10 deletions
|
@ -80,12 +80,11 @@ macro_rules! impl_typed_array {
|
||||||
if ref_.is_null() {
|
if ref_.is_null() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "wasi"))]
|
|
||||||
if CUSTOM_GC_TSFN_DESTROYED.load(Ordering::SeqCst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#[cfg(all(feature = "napi4", not(target_os = "wasi")))]
|
#[cfg(all(feature = "napi4", not(target_os = "wasi")))]
|
||||||
{
|
{
|
||||||
|
if CUSTOM_GC_TSFN_DESTROYED.load(Ordering::SeqCst) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if !THREADS_CAN_ACCESS_ENV
|
if !THREADS_CAN_ACCESS_ENV
|
||||||
.borrow_mut(|m| m.get(&std::thread::current().id()).is_some())
|
.borrow_mut(|m| m.get(&std::thread::current().id()).is_some())
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,12 +37,11 @@ impl Drop for Buffer {
|
||||||
if ref_.is_null() {
|
if ref_.is_null() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "wasi"))]
|
|
||||||
if CUSTOM_GC_TSFN_DESTROYED.load(std::sync::atomic::Ordering::SeqCst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#[cfg(all(feature = "napi4", not(target_os = "wasi")))]
|
#[cfg(all(feature = "napi4", not(target_os = "wasi")))]
|
||||||
{
|
{
|
||||||
|
if CUSTOM_GC_TSFN_DESTROYED.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if !THREADS_CAN_ACCESS_ENV.borrow_mut(|m| m.get(&std::thread::current().id()).is_some()) {
|
if !THREADS_CAN_ACCESS_ENV.borrow_mut(|m| m.get(&std::thread::current().id()).is_some()) {
|
||||||
let status = unsafe {
|
let status = unsafe {
|
||||||
sys::napi_call_threadsafe_function(
|
sys::napi_call_threadsafe_function(
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::HashMap;
|
||||||
|
#[cfg(not(feature = "noop"))]
|
||||||
|
use std::collections::HashSet;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
#[cfg(all(feature = "napi4", not(target_os = "wasi")))]
|
||||||
|
use std::sync::atomic::AtomicPtr;
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
any(target_os = "windows", target_os = "freebsd"),
|
any(target_os = "windows", target_os = "freebsd"),
|
||||||
feature = "napi4",
|
feature = "napi4",
|
||||||
feature = "tokio_rt"
|
feature = "tokio_rt"
|
||||||
))]
|
))]
|
||||||
use std::sync::atomic::AtomicUsize;
|
use std::sync::atomic::AtomicUsize;
|
||||||
use std::sync::atomic::{AtomicBool, AtomicPtr, Ordering};
|
#[cfg(not(feature = "noop"))]
|
||||||
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use std::thread::ThreadId;
|
use std::thread::ThreadId;
|
||||||
|
|
||||||
|
|
|
@ -761,6 +761,7 @@ mod experimental {
|
||||||
|
|
||||||
#[cfg(feature = "experimental")]
|
#[cfg(feature = "experimental")]
|
||||||
pub use experimental::*;
|
pub use experimental::*;
|
||||||
|
|
||||||
pub use napi1::*;
|
pub use napi1::*;
|
||||||
#[cfg(feature = "napi2")]
|
#[cfg(feature = "napi2")]
|
||||||
pub use napi2::*;
|
pub use napi2::*;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(ambiguous_glob_reexports)]
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
macro_rules! generate {
|
macro_rules! generate {
|
||||||
(extern "C" {
|
(extern "C" {
|
||||||
|
@ -30,6 +32,7 @@ macro_rules! generate {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(clippy::missing_safety_doc)]
|
||||||
pub unsafe fn load(
|
pub unsafe fn load(
|
||||||
host: &libloading::Library,
|
host: &libloading::Library,
|
||||||
) -> Result<(), libloading::Error> {
|
) -> Result<(), libloading::Error> {
|
||||||
|
|
Loading…
Reference in a new issue