Skip to content

Commit f20e5ba

Browse files
authored
Merge pull request #253 from epage/once
refactor: Avoid once_cell on new Rust
2 parents 4d45d3a + 37c9af4 commit f20e5ba

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Cargo.lock

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

crates/anstyle-wincon/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ lexopt = "0.3.0"
3333

3434
[target.'cfg(windows)'.dependencies]
3535
windows-sys = { version = "0.59.0", features = ["Win32_System_Console", "Win32_Foundation"] }
36-
once_cell = "1.20.2"
36+
once_cell_polyfill = "1.56.0"
3737

3838
[lints]
3939
workspace = true

crates/anstyle-wincon/src/windows.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ type StdioColorInnerResult = Result<(anstyle::AnsiColor, anstyle::AnsiColor), in
88

99
/// Cached [`get_colors`] call for [`std::io::stdout`]
1010
pub fn stdout_initial_colors() -> StdioColorResult {
11-
static INITIAL: once_cell::sync::OnceCell<StdioColorInnerResult> =
12-
once_cell::sync::OnceCell::new();
11+
static INITIAL: once_cell_polyfill::sync::OnceLock<StdioColorInnerResult> =
12+
once_cell_polyfill::sync::OnceLock::new();
1313
(*INITIAL.get_or_init(|| get_colors_(&std::io::stdout()))).map_err(Into::into)
1414
}
1515

1616
/// Cached [`get_colors`] call for [`std::io::stderr`]
1717
pub fn stderr_initial_colors() -> StdioColorResult {
18-
static INITIAL: once_cell::sync::OnceCell<StdioColorInnerResult> =
19-
once_cell::sync::OnceCell::new();
18+
static INITIAL: once_cell_polyfill::sync::OnceLock<StdioColorInnerResult> =
19+
once_cell_polyfill::sync::OnceLock::new();
2020
(*INITIAL.get_or_init(|| get_colors_(&std::io::stderr()))).map_err(Into::into)
2121
}
2222

0 commit comments

Comments
 (0)