aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlmetaelement.rs
diff options
context:
space:
mode:
authorHayashi Mikihiro <34ttrweoewiwe28@gmail.com>2024-08-12 16:30:35 +0900
committerGitHub <noreply@github.com>2024-08-12 07:30:35 +0000
commita797969efed10c46c7cf93e5eb7a03b52d6ca7bc (patch)
tree4321d4d361794c6f7f98e5bb0a0386da35b93b85 /components/script/dom/htmlmetaelement.rs
parentf38d1574bcb27449b8878192ac0ea3ba2ce824e7 (diff)
downloadservo-a797969efed10c46c7cf93e5eb7a03b52d6ca7bc.tar.gz
servo-a797969efed10c46c7cf93e5eb7a03b52d6ca7bc.zip
Replace the lazy_static crate whth `std::sync::LazyLock` in components/script (#33004)
* replace in str.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace navigator.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace htmlmetaelement.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace document.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace cssstyledeclaration.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace script_runtime.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace window_named_properties.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce dependency lazy_static Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce lazy in script_runtime.rs `Mutex::new()` is const contexts. I think that `JS_ENGINE` is need not lazy initialize. Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
Diffstat (limited to 'components/script/dom/htmlmetaelement.rs')
-rw-r--r--components/script/dom/htmlmetaelement.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs
index 1cbd709ae1a..45673c55652 100644
--- a/components/script/dom/htmlmetaelement.rs
+++ b/components/script/dom/htmlmetaelement.rs
@@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::str::FromStr;
+use std::sync::LazyLock;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
@@ -146,8 +147,8 @@ impl HTMLMetaElement {
}
// 2-11
- lazy_static::lazy_static! {
- static ref REFRESH_REGEX: Regex = Regex::new(
+ static REFRESH_REGEX: LazyLock<Regex> = LazyLock::new(|| {
+ Regex::new(
r#"(?x)
^
\s* # 3
@@ -169,8 +170,9 @@ impl HTMLMetaElement {
$
"#,
)
- .unwrap();
- }
+ .unwrap()
+ });
+
let mut url_record = document.url();
let captures = if let Some(captures) = REFRESH_REGEX.captures(content.as_bytes()) {
captures