switch from lazy_static to once_cell

This commit is contained in:
extrawurst 2022-09-02 09:17:34 +02:00
parent 4249a278b6
commit 5101b39556
4 changed files with 9 additions and 13 deletions

2
Cargo.lock generated
View File

@ -672,8 +672,8 @@ dependencies = [
"fuzzy-matcher",
"gh-emoji",
"itertools",
"lazy_static",
"log",
"once_cell",
"pprof",
"pretty_assertions",
"rayon-core",

View File

@ -36,8 +36,8 @@ filetreelist = { path = "./filetreelist", version = "0.5" }
fuzzy-matcher = "0.3"
gh-emoji = { version = "1.0", optional = true }
itertools = "0.10"
lazy_static = "1.4"
log = "0.4"
once_cell = "1"
rayon-core = "1.9"
ron = "0.8"
scopeguard = "1.1"

View File

@ -1,10 +1,8 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::borrow::Cow;
lazy_static! {
static ref EMOJI_REPLACER: gh_emoji::Replacer =
gh_emoji::Replacer::new();
}
static EMOJI_REPLACER: Lazy<gh_emoji::Replacer> =
Lazy::new(gh_emoji::Replacer::new);
// Replace markdown emojis with Unicode equivalent
// :hammer: --> 🔨

View File

@ -2,7 +2,7 @@ use asyncgit::{
asyncjob::{AsyncJob, RunParams},
ProgressPercent,
};
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use scopetime::scope_time;
use std::{
ffi::OsStr,
@ -32,11 +32,9 @@ pub struct SyntaxText {
path: PathBuf,
}
lazy_static! {
static ref SYNTAX_SET: SyntaxSet =
SyntaxSet::load_defaults_nonewlines();
static ref THEME_SET: ThemeSet = ThemeSet::load_defaults();
}
static SYNTAX_SET: Lazy<SyntaxSet> =
Lazy::new(SyntaxSet::load_defaults_nonewlines);
static THEME_SET: Lazy<ThemeSet> = Lazy::new(ThemeSet::load_defaults);
pub struct AsyncProgressBuffer {
current: usize,