Skip to content

Commit ac1c0dd

Browse files
refactor: Use LazyLock from std instead of once_cell (#15)
1 parent 71c8565 commit ac1c0dd

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

Cargo.lock

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ keywords = ["toc", "markdown", "commonmark", "pulldown-cmark", "github"]
1111
categories = ["text-processing"]
1212

1313
[dependencies]
14-
once_cell = "1.18.0"
1514
pulldown-cmark = { version = "0.13", default-features = false }
1615
regex = "1.9.3"

src/slug.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use std::{borrow::Cow, collections::HashMap};
1+
use std::{borrow::Cow, collections::HashMap, sync::LazyLock};
22

3-
use once_cell::sync::Lazy;
43
use regex::Regex;
54

65
/// A trait to specify the anchor calculation.
@@ -23,7 +22,7 @@ pub struct GitHubSlugifier {
2322

2423
impl Slugify for GitHubSlugifier {
2524
fn slugify<'a>(&mut self, str: &'a str) -> Cow<'a, str> {
26-
static RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"[^\w\- ]").unwrap());
25+
static RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"[^\w\- ]").unwrap());
2726
let anchor = RE
2827
.replace_all(&str.to_lowercase().replace(' ', "-"), "")
2928
.into_owned();

0 commit comments

Comments
 (0)