replace lazy_static with once_cell

This commit is contained in:
mposmta 2020-04-09 14:30:16 +02:00 committed by marin
parent c3d5778aae
commit a0a481697b
3 changed files with 9 additions and 13 deletions

5
Cargo.lock generated
View File

@ -1087,7 +1087,6 @@ dependencies = [
"intervaltree", "intervaltree",
"itertools 0.9.0", "itertools 0.9.0",
"jemallocator", "jemallocator",
"lazy_static",
"levenshtein_automata", "levenshtein_automata",
"log", "log",
"meilisearch-schema", "meilisearch-schema",
@ -1095,7 +1094,7 @@ dependencies = [
"meilisearch-types", "meilisearch-types",
"once_cell", "once_cell",
"ordered-float", "ordered-float",
"pest 2.1.3 (git+https://github.com/MarinPostma/pest.git)", "pest 2.1.3 (git+https://github.com/MarinPostma/pest.git?tag=meilisearch-patch1)",
"pest_derive", "pest_derive",
"regex", "regex",
"rustyline", "rustyline",
@ -1406,7 +1405,7 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]] [[package]]
name = "pest" name = "pest"
version = "2.1.3" version = "2.1.3"
source = "git+https://github.com/MarinPostma/pest.git#e1031ad0134d5e9893c470dbea50811b2b746926" source = "git+https://github.com/MarinPostma/pest.git?tag=meilisearch-patch1#e1031ad0134d5e9893c470dbea50811b2b746926"
dependencies = [ dependencies = [
"ucd-trie", "ucd-trie",
] ]

View File

@ -20,7 +20,6 @@ heed = "0.7.0"
indexmap = { version = "1.3.2", features = ["serde-1"] } indexmap = { version = "1.3.2", features = ["serde-1"] }
intervaltree = "0.2.5" intervaltree = "0.2.5"
itertools = "0.9.0" itertools = "0.9.0"
lazy_static = "1.4.0"
levenshtein_automata = { version = "0.1.1", features = ["fst_automaton"] } levenshtein_automata = { version = "0.1.1", features = ["fst_automaton"] }
log = "0.4.8" log = "0.4.8"
meilisearch-schema = { path = "../meilisearch-schema", version = "0.9.0" } meilisearch-schema = { path = "../meilisearch-schema", version = "0.9.0" }
@ -28,7 +27,7 @@ meilisearch-tokenizer = { path = "../meilisearch-tokenizer", version = "0.9.0" }
meilisearch-types = { path = "../meilisearch-types", version = "0.9.0" } meilisearch-types = { path = "../meilisearch-types", version = "0.9.0" }
once_cell = "1.3.1" once_cell = "1.3.1"
ordered-float = { version = "1.0.2", features = ["serde"] } ordered-float = { version = "1.0.2", features = ["serde"] }
pest = {git = "https://github.com/MarinPostma/pest.git"} pest = { git = "https://github.com/MarinPostma/pest.git", tag = "meilisearch-patch1" }
pest_derive = "2.0" pest_derive = "2.0"
regex = "1.3.6" regex = "1.3.6"
sdset = "0.4.0" sdset = "0.4.0"

View File

@ -1,13 +1,11 @@
use lazy_static::lazy_static; use once_cell::sync::Lazy;
use pest::prec_climber::{Operator, Assoc, PrecClimber}; use pest::prec_climber::{Operator, Assoc, PrecClimber};
lazy_static! { pub static PREC_CLIMBER: Lazy<PrecClimber<Rule>> = Lazy::new(|| {
pub static ref PREC_CLIMBER: PrecClimber<Rule> = { use Assoc::*;
use Assoc::*; use Rule::*;
use Rule::*; pest::prec_climber::PrecClimber::new(vec![Operator::new(or, Left), Operator::new(and, Left)])
pest::prec_climber::PrecClimber::new(vec![Operator::new(or, Left), Operator::new(and, Left)]) });
};
}
#[derive(Parser)] #[derive(Parser)]
#[grammar = "filters/parser/grammar.pest"] #[grammar = "filters/parser/grammar.pest"]