From 6de53b631fcdb96d72639b6d2db3592d5fa8498d Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sun, 19 Dec 2021 02:44:42 +0530 Subject: refactor: use `once_cell` instead of `lazy_static` (#13135) --- runtime/permissions.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime/permissions.rs') diff --git a/runtime/permissions.rs b/runtime/permissions.rs index 50c126f3f..1b0d8b914 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -16,6 +16,7 @@ use deno_core::url; use deno_core::ModuleSpecifier; use deno_core::OpState; use log; +use once_cell::sync::Lazy; use std::collections::HashSet; use std::fmt; use std::hash::Hash; @@ -29,9 +30,8 @@ use std::sync::atomic::Ordering; const PERMISSION_EMOJI: &str = "⚠️"; -lazy_static::lazy_static! { - static ref DEBUG_LOG_ENABLED: bool = log::log_enabled!(log::Level::Debug); -} +static DEBUG_LOG_ENABLED: Lazy = + Lazy::new(|| log::log_enabled!(log::Level::Debug)); /// Tri-state value for storing permission state #[derive(PartialEq, Debug, Clone, Copy, Deserialize, PartialOrd)] @@ -2017,9 +2017,9 @@ fn permission_prompt(_message: &str) -> bool { static STUB_PROMPT_VALUE: AtomicBool = AtomicBool::new(true); #[cfg(test)] -lazy_static::lazy_static! { - static ref PERMISSION_PROMPT_STUB_VALUE_SETTER: Mutex = Mutex::new(PermissionPromptStubValueSetter); -} +static PERMISSION_PROMPT_STUB_VALUE_SETTER: Lazy< + Mutex, +> = Lazy::new(|| Mutex::new(PermissionPromptStubValueSetter)); #[cfg(test)] struct PermissionPromptStubValueSetter; -- cgit v1.2.3