Replace lazy_static! with once_cell::sync::Lazy

As per
276134eb93 (r37745873),
this allows us to avoid a macro call and get better autocompletion
within the declaration.
This commit is contained in:
ConnorSkees 2020-03-10 21:19:23 -04:00
parent 276134eb93
commit 8458106833
2 changed files with 11 additions and 13 deletions

View File

@ -22,10 +22,10 @@ path = "src/lib.rs"
[dependencies]
clap = { version = "2.33.0", optional = true }
lazy_static = "1.4.0"
num-rational = "0.2.3"
num-bigint = "0.2.6"
num-traits = "0.2.11"
once_cell = "1.3.1"
[features]
default = ["commandline"]

View File

@ -1,4 +1,4 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use crate::args::CallArgs;
@ -19,14 +19,12 @@ mod string;
pub(crate) type Builtin = Box<dyn Fn(&mut CallArgs, &Scope) -> SassResult<Value> + Send + Sync>;
lazy_static! {
pub(crate) static ref GLOBAL_FUNCTIONS: HashMap<String, Builtin> = {
let mut m = HashMap::new();
color::register(&mut m);
list::register(&mut m);
math::register(&mut m);
meta::register(&mut m);
string::register(&mut m);
m
};
}
pub(crate) static GLOBAL_FUNCTIONS: Lazy<HashMap<String, Builtin>> = Lazy::new(|| {
let mut m = HashMap::new();
color::register(&mut m);
list::register(&mut m);
math::register(&mut m);
meta::register(&mut m);
string::register(&mut m);
m
});