From 147eb4196acea76110b4adb26a295089e2365df5 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 23 Feb 2025 08:03:45 +0100 Subject: [PATCH] Don't use LazyLock just yet. To prevent this from happening again, also set `rust-version` on the top-level. --- Cargo.toml | 1 + src/shared.rs | 2 +- tests/it/Cargo.toml | 1 + tests/it/src/commands/check_mode.rs | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a4363e5d151..4a2cdb60945 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ authors = ["Sebastian Thiel "] edition = "2021" license = "MIT OR Apache-2.0" version = "0.41.0" +rust-version = "1.74" default-run = "gix" include = ["src/**/*", "/build.rs", "LICENSE-*", "README.md"] resolver = "2" diff --git a/src/shared.rs b/src/shared.rs index 610372416c0..6fbad8a1f0d 100644 --- a/src/shared.rs +++ b/src/shared.rs @@ -327,7 +327,7 @@ mod clap { #[derive(Clone)] pub struct AsPathSpec; - static PATHSPEC_DEFAULTS: std::sync::LazyLock = std::sync::LazyLock::new(|| { + static PATHSPEC_DEFAULTS: once_cell::sync::Lazy = once_cell::sync::Lazy::new(|| { gix::pathspec::Defaults::from_environment(&mut |n| std::env::var_os(n)).unwrap_or_default() }); diff --git a/tests/it/Cargo.toml b/tests/it/Cargo.toml index 6d7fde351d8..1fe9ec4111c 100644 --- a/tests/it/Cargo.toml +++ b/tests/it/Cargo.toml @@ -8,6 +8,7 @@ authors = ["Sebastian Thiel "] edition = "2021" license = "MIT OR Apache-2.0" publish = false +rust-version = "1.74.0" [[bin]] name = "it" diff --git a/tests/it/src/commands/check_mode.rs b/tests/it/src/commands/check_mode.rs index 02a2ac91430..35f95d78cad 100644 --- a/tests/it/src/commands/check_mode.rs +++ b/tests/it/src/commands/check_mode.rs @@ -1,7 +1,7 @@ pub(super) mod function { use anyhow::{bail, Context}; use gix::bstr::ByteSlice; - + use once_cell::sync::Lazy; use regex::bytes::Regex; use std::ffi::{OsStr, OsString}; use std::io::{BufRead, BufReader, Read}; @@ -66,7 +66,7 @@ pub(super) mod function { /// On mismatch, report it and return `Some(true)`. fn check_for_mismatch(root: &OsStr, record: &[u8]) -> anyhow::Result { - static RECORD_REGEX: std::sync::LazyLock = std::sync::LazyLock::new(|| { + static RECORD_REGEX: Lazy = Lazy::new(|| { let pattern = r"(?-u)\A([0-7]+) ([[:xdigit:]]+) [[:digit:]]+\t(.+)\z"; Regex::new(pattern).expect("regex should be valid") });