From 8ee55833413380b16d3347e0abec8d5f706ea573 Mon Sep 17 00:00:00 2001 From: Gwen Lg Date: Sat, 14 Sep 2024 15:54:29 +0200 Subject: [PATCH] wip clean: replace once_cell::Lazy by std LazyLock this allow to remove once_cell dependency. Warning: Need at least rust 1.80 --- Cargo.lock | 7 ------- Cargo.toml | 1 - src/vobsub/idx.rs | 5 +++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 88c820f..4487f00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -257,12 +257,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" - [[package]] name = "png" version = "0.17.13" @@ -359,7 +353,6 @@ dependencies = [ "iter_fixed", "log", "nom", - "once_cell", "profiling", "regex", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 7c0e0b0..1e7b024 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ image = { version = "0.25", default-features = false, features = ["png"] } iter_fixed = "0.4" log = "0.4" nom = "7.1" -once_cell = "1.19" profiling = "1.0" regex = "1.10" thiserror = "1.0" diff --git a/src/vobsub/idx.rs b/src/vobsub/idx.rs index 2f8aa77..4e5d240 100644 --- a/src/vobsub/idx.rs +++ b/src/vobsub/idx.rs @@ -1,12 +1,12 @@ //! Parse a file in `*.idx` format. use log::trace; -use once_cell::sync::Lazy; use regex::Regex; use std::{ fs, io::{self, prelude::*, BufReader}, path::Path, + sync::LazyLock, }; use super::{palette, sub, IResultExt, Palette, VobSubError}; @@ -90,7 +90,8 @@ where T: std::io::Read, Err: Fn(io::Error) -> VobSubError, { - static KEY_VALUE: Lazy = Lazy::new(|| Regex::new("^([A-Za-z/ ]+): (.*)").unwrap()); + static KEY_VALUE: LazyLock = + LazyLock::new(|| Regex::new("^([A-Za-z/ ]+): (.*)").unwrap()); let mut palette_val: Option = None; let mut buf = String::with_capacity(256);