mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-25 15:29:43 -05:00
refactor: migrate from lazy_static to once_cell (#1210)
This commit is contained in:
parent
5dce1eaeef
commit
9394983d15
5 changed files with 9 additions and 13 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -839,9 +839,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.9.0"
|
||||
version = "1.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
|
||||
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
|
@ -1188,7 +1188,7 @@ dependencies = [
|
|||
"align-data",
|
||||
"bitflags",
|
||||
"fslock",
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
"trybuild",
|
||||
"which",
|
||||
]
|
||||
|
|
|
@ -80,7 +80,7 @@ use_custom_libcxx = []
|
|||
|
||||
[dependencies]
|
||||
bitflags = "1.3.2"
|
||||
lazy_static = "1.4.0"
|
||||
once_cell = "1.17.1"
|
||||
|
||||
[build-dependencies]
|
||||
fslock = "0.1.8"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2019-2021 the Deno authors. All rights reserved. MIT license.
|
||||
use once_cell::sync::Lazy;
|
||||
use std::ffi::CStr;
|
||||
use std::ffi::CString;
|
||||
use std::sync::Mutex;
|
||||
|
@ -71,9 +72,8 @@ enum GlobalState {
|
|||
}
|
||||
use GlobalState::*;
|
||||
|
||||
lazy_static! {
|
||||
static ref GLOBAL_STATE: Mutex<GlobalState> = Mutex::new(Uninitialized);
|
||||
}
|
||||
static GLOBAL_STATE: Lazy<Mutex<GlobalState>> =
|
||||
Lazy::new(|| Mutex::new(Uninitialized));
|
||||
|
||||
pub fn assert_initialized() {
|
||||
let global_state_guard = GLOBAL_STATE.lock().unwrap();
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
mod array_buffer;
|
||||
mod array_buffer_view;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2019-2021 the Deno authors. All rights reserved. MIT license.
|
||||
use lazy_static::lazy_static;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::any::type_name;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
|
@ -7480,9 +7480,7 @@ fn counter_lookup_callback() {
|
|||
unsafe impl Send for Name {}
|
||||
unsafe impl Send for Count {}
|
||||
|
||||
lazy_static! {
|
||||
static ref MAP: Arc<Mutex<HashMap<Name, Count>>> = Arc::default();
|
||||
}
|
||||
static MAP: Lazy<Arc<Mutex<HashMap<Name, Count>>>> = Lazy::new(Arc::default);
|
||||
|
||||
// |name| points to a static zero-terminated C string.
|
||||
extern "C" fn callback(name: *const c_char) -> *mut i32 {
|
||||
|
|
Loading…
Reference in a new issue