Replace the lazy_static crate with std::sync::LazyLock in components/shared (#33060)

* replace in pub_domains.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in embedder/resources.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in base/id.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in net/lib.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* remove lazy_static from components/shared

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
Hayashi Mikihiro 2024-08-15 21:05:29 +09:00 committed by GitHub
parent 8f82b2a7cb
commit 86c4e014b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 19 additions and 37 deletions

View file

@ -5,6 +5,7 @@
#![deny(unsafe_code)]
use std::fmt::Display;
use std::sync::LazyLock;
use std::time::{SystemTime, UNIX_EPOCH};
use base::id::HistoryStateId;
@ -16,7 +17,6 @@ use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use ipc_channel::Error as IpcError;
use lazy_static::lazy_static;
use malloc_size_of::malloc_size_of_is_0;
use malloc_size_of_derive::MallocSizeOf;
use mime::Mime;
@ -819,6 +819,5 @@ pub fn http_percent_encode(bytes: &[u8]) -> String {
percent_encoding::percent_encode(bytes, HTTP_VALUE).to_string()
}
lazy_static! {
pub static ref PRIVILEGED_SECRET: u32 = servo_rand::ServoRng::default().next_u32();
}
pub static PRIVILEGED_SECRET: LazyLock<u32> =
LazyLock::new(|| servo_rand::ServoRng::default().next_u32());