From baa330c49c8f598c67296175e1fb165abacebaca Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 1 Dec 2024 10:38:16 +0800 Subject: [PATCH] Use once_cell to lower MSRV std `LazyLock` requires Rust 1.80 which is bit too new for using this in maturin. --- Cargo.lock | 3 ++- Cargo.toml | 1 + src/version.rs | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6880c01..fe20580 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "bytecheck" @@ -96,6 +96,7 @@ name = "pep440_rs" version = "0.7.2" dependencies = [ "indoc", + "once_cell", "rkyv", "serde", "tracing", diff --git a/Cargo.toml b/Cargo.toml index e623875..0ea61f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ name = "pep440_rs" crate-type = ["rlib", "cdylib"] [dependencies] +once_cell = { version = "1.20.2" } serde = { version = "1.0.210", features = ["derive"] } rkyv = { version = "0.8.8", optional = true } tracing = { version = "0.1.40", optional = true } diff --git a/src/version.rs b/src/version.rs index 26b3831..36fca64 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1,5 +1,5 @@ +use once_cell::sync::Lazy; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; -use std::sync::LazyLock; use std::{ borrow::Borrow, cmp::Ordering, @@ -2395,8 +2395,7 @@ fn parse_u64(bytes: &[u8]) -> Result { } /// The minimum version that can be represented by a [`Version`]: `0a0.dev0`. -pub static MIN_VERSION: LazyLock = - LazyLock::new(|| Version::from_str("0a0.dev0").unwrap()); +pub static MIN_VERSION: Lazy = Lazy::new(|| Version::from_str("0a0.dev0").unwrap()); #[cfg(test)] mod tests;