Skip to content

Commit a020c10

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 a020c10

File tree

29 files changed

+59
-77
lines changed

29 files changed

+59
-77
lines changed

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"

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();

gix-fsck/tests/connectivity/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use gix_fsck::Connectivity;
22
use gix_hash::ObjectId;
33
use gix_hashtable::HashMap;
44
use gix_object::Kind;
5-
use gix_testtools::once_cell::sync::Lazy;
5+
use std::sync::LazyLock;
66

77
use crate::hex_to_id;
88

@@ -40,7 +40,7 @@ fn hex_to_objects<'a>(hex_ids: impl IntoIterator<Item = &'a str>, kind: Kind) ->
4040

4141
// Get a `&Vec<ObjectID` for each commit in the test fixture repository
4242
fn all_commits() -> &'static [ObjectId] {
43-
static ALL_COMMITS: Lazy<Vec<ObjectId>> = Lazy::new(|| {
43+
static ALL_COMMITS: LazyLock<Vec<ObjectId>> = LazyLock::new(|| {
4444
hex_to_ids([
4545
"ebed23648b19484cb1f340c4ee04dda08479188a",
4646
"8ff6d0f8891c3cb22827be142cc64606121d47b3",

gix-path/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = "A crate of the gitoxide project dealing paths and their conversio
77
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
88
edition = "2021"
99
include = ["src/**/*", "LICENSE-*"]
10-
rust-version = "1.65"
10+
rust-version = "1.80"
1111

1212
[lib]
1313
doctest = false
@@ -16,7 +16,6 @@ doctest = false
1616
gix-trace = { version = "^0.1.8", path = "../gix-trace" }
1717
bstr = { version = "1.3.0", default-features = false, features = ["std"] }
1818
thiserror = "1.0.26"
19-
once_cell = "1.17.1"
2019

2120
[target.'cfg(not(target_family = "wasm"))'.dependencies]
2221
home = "0.5.5"

0 commit comments

Comments
 (0)