diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-12-19 02:44:42 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-18 16:14:42 -0500 |
commit | 6de53b631fcdb96d72639b6d2db3592d5fa8498d (patch) | |
tree | 9a93d868f5f434a4898f212cb6bd53e65ca49ce0 /runtime/permissions.rs | |
parent | 3db18bf9e6466c74efd9052df4d372ea0b581154 (diff) |
refactor: use `once_cell` instead of `lazy_static` (#13135)
Diffstat (limited to 'runtime/permissions.rs')
-rw-r--r-- | runtime/permissions.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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<bool> = + 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<PermissionPromptStubValueSetter> = Mutex::new(PermissionPromptStubValueSetter); -} +static PERMISSION_PROMPT_STUB_VALUE_SETTER: Lazy< + Mutex<PermissionPromptStubValueSetter>, +> = Lazy::new(|| Mutex::new(PermissionPromptStubValueSetter)); #[cfg(test)] struct PermissionPromptStubValueSetter; |