time: remove lazy_static dependency

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2024-08-14 09:19:55 +02:00 committed by Wolfgang Bumiller
parent 25f83bce19
commit 669c39c59f
2 changed files with 47 additions and 49 deletions

View File

@ -6,13 +6,13 @@ edition.workspace = true
license.workspace = true license.workspace = true
repository.workspace = true repository.workspace = true
description = "time utilities and TmEditor" description = "time utilities and TmEditor"
rust-version.workspace = true
exclude.workspace = true exclude.workspace = true
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true
bitflags.workspace = true bitflags.workspace = true
lazy_static.workspace = true
nom = "7" nom = "7"
[target.'cfg(not(target_arch="wasm32"))'.dependencies] [target.'cfg(not(target_arch="wasm32"))'.dependencies]

View File

@ -1,13 +1,12 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::LazyLock;
use anyhow::Error; use anyhow::Error;
use lazy_static::lazy_static;
use nom::{bytes::complete::take_while1, character::complete::space0, combinator::opt}; use nom::{bytes::complete::take_while1, character::complete::space0, combinator::opt};
use crate::parse_helpers::{parse_complete_line, parse_error, parse_u64, IResult}; use crate::parse_helpers::{parse_complete_line, parse_error, parse_u64, IResult};
lazy_static! { static TIME_SPAN_UNITS: LazyLock<HashMap<&'static str, f64>> = LazyLock::new(|| {
static ref TIME_SPAN_UNITS: HashMap<&'static str, f64> = {
let mut map = HashMap::new(); let mut map = HashMap::new();
let second = 1.0; let second = 1.0;
@ -72,8 +71,7 @@ lazy_static! {
map.insert("y", year); map.insert("y", year);
map map
}; });
}
/// A time spans defines a time duration /// A time spans defines a time duration
#[derive(Default, Clone, Debug)] #[derive(Default, Clone, Debug)]