Skip to content

Commit

Permalink
Don't use LazyLock just yet.
Browse files Browse the repository at this point in the history
To prevent this from happening again, also set `rust-version` on the top-level.
  • Loading branch information
Byron committed Feb 23, 2025
1 parent 8776a3e commit 147eb41
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ authors = ["Sebastian Thiel <[email protected]>"]
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"
Expand Down
2 changes: 1 addition & 1 deletion src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ mod clap {
#[derive(Clone)]
pub struct AsPathSpec;

static PATHSPEC_DEFAULTS: std::sync::LazyLock<gix::pathspec::Defaults> = std::sync::LazyLock::new(|| {
static PATHSPEC_DEFAULTS: once_cell::sync::Lazy<gix::pathspec::Defaults> = once_cell::sync::Lazy::new(|| {
gix::pathspec::Defaults::from_environment(&mut |n| std::env::var_os(n)).unwrap_or_default()
});

Expand Down
1 change: 1 addition & 0 deletions tests/it/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false
rust-version = "1.74.0"

[[bin]]
name = "it"
Expand Down
4 changes: 2 additions & 2 deletions tests/it/src/commands/check_mode.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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<bool> {
static RECORD_REGEX: std::sync::LazyLock<Regex> = std::sync::LazyLock::new(|| {
static RECORD_REGEX: Lazy<Regex> = Lazy::new(|| {
let pattern = r"(?-u)\A([0-7]+) ([[:xdigit:]]+) [[:digit:]]+\t(.+)\z";
Regex::new(pattern).expect("regex should be valid")
});
Expand Down

0 comments on commit 147eb41

Please sign in to comment.