mirror of
https://github.com/servo/servo.git
synced 2025-08-21 13:25:34 +01:00
Replace lazy_static with std::sync::LazyLock in components/fonts (#33049)
* replace in shaper.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in android/font_list.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in ohos/font_list.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * remove lazy_lock from components/fonts Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
parent
7633bdccd2
commit
ad85dd10e3
5 changed files with 17 additions and 22 deletions
|
@ -5,6 +5,7 @@
|
|||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use base::text::{is_cjk, UnicodeBlock, UnicodeBlockMethod};
|
||||
use log::warn;
|
||||
|
@ -21,9 +22,7 @@ use crate::{
|
|||
FallbackFontSelectionOptions, FontTemplate, FontTemplateDescriptor, LowercaseFontFamilyName,
|
||||
};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref FONT_LIST: FontList = FontList::new();
|
||||
}
|
||||
static FONT_LIST: LazyLock<FontList> = LazyLock::new(|| FontList::new());
|
||||
|
||||
/// An identifier for a local font on Android systems.
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
|
||||
|
|
|
@ -7,6 +7,7 @@ use std::fs::File;
|
|||
use std::io::Read;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::LazyLock;
|
||||
use std::{fs, io};
|
||||
|
||||
use base::text::{UnicodeBlock, UnicodeBlockMethod};
|
||||
|
@ -25,9 +26,7 @@ use crate::{
|
|||
FontTemplateDescriptor, LowercaseFontFamilyName,
|
||||
};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref FONT_LIST: FontList = FontList::new();
|
||||
}
|
||||
static FONT_LIST: LazyLock<FontList> = LazyLock::new(|| FontList::new());
|
||||
|
||||
/// When testing the ohos font code on linux, we can pass the fonts directory of the SDK
|
||||
/// via an environment variable.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue