Skip to content

Commit 4444630

Browse files
authored
generator: Replace once_cell with std::sync::LazyLock (#1003)
1 parent 4942dc3 commit 4444630

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

generator/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ bindgen = "=0.69.4"
1313
heck = "0.5"
1414
itertools = "0.14"
1515
nom = "8"
16-
once_cell = "1.7"
1716
proc-macro2 = "1.0"
1817
quote = "1.0"
1918
regex = "1.4"

generator/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use nom::{
2121
sequence::{delimited, pair, preceded, separated_pair, terminated},
2222
IResult, Parser,
2323
};
24-
use once_cell::sync::Lazy;
2524
use proc_macro2::{Delimiter, Group, Literal, Span, TokenStream, TokenTree};
2625
use quote::*;
2726
use regex::Regex;
@@ -31,6 +30,7 @@ use std::{
3130
fmt::Display,
3231
ops::Not,
3332
path::Path,
33+
sync::LazyLock,
3434
};
3535
use syn::Ident;
3636

@@ -326,7 +326,7 @@ pub trait ConstantExt {
326326
fn variant_ident(&self, enum_name: &str) -> Ident;
327327
fn notation(&self) -> Option<&str>;
328328
fn formatted_notation(&self) -> Option<Cow<'_, str>> {
329-
static DOC_LINK: Lazy<Regex> = Lazy::new(|| Regex::new(r"<<([\w-]+)>>").unwrap());
329+
static DOC_LINK: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"<<([\w-]+)>>").unwrap());
330330
self.notation().map(|n| {
331331
DOC_LINK.replace(
332332
n,
@@ -1586,7 +1586,7 @@ pub enum EnumType {
15861586
Enum(TokenStream),
15871587
}
15881588

1589-
static TRAILING_NUMBER: Lazy<Regex> = Lazy::new(|| Regex::new("(\\d+)$").unwrap());
1589+
static TRAILING_NUMBER: LazyLock<Regex> = LazyLock::new(|| Regex::new("(\\d+)$").unwrap());
15901590

15911591
pub fn variant_ident(enum_name: &str, variant_name: &str) -> Ident {
15921592
let variant_name = variant_name.to_uppercase();

0 commit comments

Comments
 (0)