Skip to content

Commit 24da639

Browse files
committed
remove once_cell (upon next MSRV bump!)
When the next MSRV bump might be coming up once_cell can be cut in favor of std's own Lazy primitives
1 parent 7739764 commit 24da639

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

meta/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ include = [
1919
"_README.md",
2020
"LICENSE-*",
2121
]
22-
rust-version = "1.65"
22+
rust-version = "1.80"
2323

2424
[dependencies]
2525
pest = { path = "../pest", version = "2.8.0" }
26-
once_cell = "1.8.0"
2726

2827
[build-dependencies]
2928
sha2 = { version = "0.10", default-features = false }

meta/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#[macro_use]
2121
extern crate pest;
2222

23-
use once_cell::sync::Lazy;
2423
use std::fmt::Display;
24+
use std::sync::LazyLock;
2525

2626
use pest::error::Error;
2727
use pest::unicode::unicode_property_names;
@@ -72,5 +72,5 @@ pub fn parse_and_optimize(
7272

7373
#[doc(hidden)]
7474
#[deprecated(note = "use `pest::unicode::unicode_property_names` instead")]
75-
pub static UNICODE_PROPERTY_NAMES: Lazy<Vec<&str>> =
76-
Lazy::new(|| unicode_property_names().collect::<Vec<_>>());
75+
pub static UNICODE_PROPERTY_NAMES: LazyLock<Vec<&str>> =
76+
LazyLock::new(|| unicode_property_names().collect::<Vec<_>>());

meta/src/validator.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
//! Helpers for validating pest grammars that could help with debugging
1111
//! and provide a more user-friendly error message.
1212
13-
use once_cell::sync::Lazy;
14-
use std::collections::{HashMap, HashSet};
13+
use std::{collections::{HashMap, HashSet}, sync::LazyLock};
1514

1615
use pest::error::{Error, ErrorVariant, InputLocation};
1716
use pest::iterators::Pairs;
@@ -20,7 +19,7 @@ use pest::Span;
2019

2120
use crate::parser::{ParserExpr, ParserNode, ParserRule, Rule};
2221

23-
static RUST_KEYWORDS: Lazy<HashSet<&'static str>> = Lazy::new(|| {
22+
static RUST_KEYWORDS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
2423
[
2524
"abstract", "alignof", "as", "become", "box", "break", "const", "continue", "crate", "do",
2625
"else", "enum", "extern", "false", "final", "fn", "for", "if", "impl", "in", "let", "loop",
@@ -33,7 +32,7 @@ static RUST_KEYWORDS: Lazy<HashSet<&'static str>> = Lazy::new(|| {
3332
.collect()
3433
});
3534

36-
static PEST_KEYWORDS: Lazy<HashSet<&'static str>> = Lazy::new(|| {
35+
static PEST_KEYWORDS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
3736
[
3837
"_", "ANY", "DROP", "EOI", "PEEK", "PEEK_ALL", "POP", "POP_ALL", "PUSH", "SOI",
3938
]
@@ -42,7 +41,7 @@ static PEST_KEYWORDS: Lazy<HashSet<&'static str>> = Lazy::new(|| {
4241
.collect()
4342
});
4443

45-
static BUILTINS: Lazy<HashSet<&'static str>> = Lazy::new(|| {
44+
static BUILTINS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
4645
[
4746
"ANY",
4847
"DROP",

0 commit comments

Comments
 (0)