Skip to content

Commit acd33f4

Browse files
authored
Drop once_cell::sync::Lazy in favor of std::sync::LazyLock
This almost completely drops the `once_cell` crate, but `OnceCell` is still in use. While the `OnceCell` type is available in the standard library, the `get_or_try_init` method is not yet stabilized. This bumps the MSRV up to 1.80, which is the first version to stabilize `std::sync::LazyLock`.
1 parent 7c00d13 commit acd33f4

File tree

31 files changed

+63
-81
lines changed

31 files changed

+63
-81
lines changed

.github/workflows/msrv.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
env:
2626
# dictated by `firefox` to support the `helix` editor, but now probably effectively be controlled by `jiff`, which also aligns with `regex`.
2727
# IMPORTANT: adjust etc/msrv-badge.svg as well
28-
rust_version: 1.74.0
28+
rust_version: 1.80.0
2929
steps:
3030
- uses: actions/checkout@v4
3131
- uses: extractions/setup-just@v2

Cargo.lock

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ terminal_size = "0.3.0"
190190
# Avoid pre-compiled binaries, see https://github.com/serde-rs/serde/issues/2538 and https://github.com/serde-rs/serde/pull/2590
191191
serde_derive = ">=1.0.185"
192192

193-
once_cell = "1.18.0"
194193
document-features = { version = "0.2.0", optional = true }
195194

196195
[profile.dev.package]

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.74.0"
1+
msrv = "1.80.0"

etc/msrv-badge.svg

Lines changed: 3 additions & 3 deletions
Loading

gix-config/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2021"
99
keywords = ["git-config", "git", "config", "gitoxide"]
1010
categories = ["config", "parser-implementations"]
1111
include = ["src/**/*", "LICENSE-*", "README.md"]
12-
rust-version = "1.65"
12+
rust-version = "1.80"
1313
autotests = false
1414

1515
[features]
@@ -31,7 +31,6 @@ unicode-bom.workspace = true
3131
bstr = { version = "1.3.0", default-features = false, features = ["std"] }
3232
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] }
3333
smallvec = "1.9.0"
34-
once_cell = "1.14.0"
3534

3635
document-features = { version = "0.2.0", optional = true }
3736

gix-credentials/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ document-features = { version = "0.2.1", optional = true }
3636
[dev-dependencies]
3737
gix-testtools = { path = "../tests/tools" }
3838
gix-sec = { path = "../gix-sec" }
39-
once_cell = "1.19.0"
4039

4140
[package.metadata.docs.rs]
4241
all-features = true

gix-credentials/tests/program/from_custom_definition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use gix_credentials::{helper, program::Kind, Program};
22

3-
static GIT: once_cell::sync::Lazy<&'static str> =
4-
once_cell::sync::Lazy::new(|| gix_path::env::exe_invocation().to_str().expect("not illformed"));
3+
static GIT: std::sync::LazyLock<&'static str> =
4+
std::sync::LazyLock::new(|| gix_path::env::exe_invocation().to_str().expect("not illformed"));
55

66
#[cfg(windows)]
77
const SH: &str = "sh";

gix-date/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ document-features = { version = "0.2.0", optional = true }
2727

2828
[dev-dependencies]
2929
gix-testtools = { path = "../tests/tools" }
30-
once_cell = "1.12.0"
3130
gix-hash = { path = "../gix-hash" }
3231

3332
[package.metadata.docs.rs]

gix-date/tests/time/baseline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ use gix_date::{
55
SecondsSinceUnixEpoch,
66
};
77
use gix_testtools::Result;
8-
use once_cell::sync::Lazy;
8+
use std::sync::LazyLock;
99

1010
struct Sample {
1111
format_name: Option<String>,
1212
exit_code: usize,
1313
seconds: SecondsSinceUnixEpoch,
1414
}
1515

16-
static BASELINE: Lazy<HashMap<String, Sample>> = Lazy::new(|| {
16+
static BASELINE: LazyLock<HashMap<String, Sample>> = LazyLock::new(|| {
1717
(|| -> Result<_> {
1818
let base = gix_testtools::scripted_fixture_read_only("generate_git_date_baseline.sh")?;
1919
let mut map = HashMap::new();

0 commit comments

Comments
 (0)