mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
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>
This commit is contained in:
parent
f38d1574bc
commit
a797969efe
9 changed files with 98 additions and 104 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue