Skip to content

Commit

Permalink
switch from once_cell to std::sync::OnceLock
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobhellermann committed Feb 3, 2025
1 parent c4ee249 commit b4805ed
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 13 deletions.
7 changes: 2 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ rust-version = "1.65.0"

[workspace.dependencies]
indenter = "0.3.0"
once_cell = "1.18.0"
owo-colors = "4.0"
autocfg = "1.0"

Expand Down
1 change: 0 additions & 1 deletion color-eyre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ backtrace = { version = "0.3.59" }
indenter = { workspace = true }
owo-colors = { workspace = true }
color-spantrace = { version = "0.2", path = "../color-spantrace", optional = true }
once_cell = { workspace = true }
url = { version = "2.1.1", optional = true }

[dev-dependencies]
Expand Down
1 change: 0 additions & 1 deletion color-spantrace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ rust-version = { workspace = true }
tracing-error = "0.2.0"
tracing-core = "0.1.21"
owo-colors = { workspace = true }
once_cell = { workspace = true }

[dev-dependencies]
tracing-subscriber = "0.3.4"
Expand Down
4 changes: 2 additions & 2 deletions color-spantrace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@
unused_parens,
while_true
)]
use once_cell::sync::OnceCell;
use owo_colors::{style, Style};
use std::env;
use std::fmt;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::sync::OnceLock;
use tracing_error::SpanTrace;

static THEME: OnceCell<Theme> = OnceCell::new();
static THEME: OnceLock<Theme> = OnceLock::new();

/// A struct that represents theme that is used by `color_spantrace`
#[derive(Debug, Copy, Clone, Default)]
Expand Down
1 change: 0 additions & 1 deletion eyre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ track-caller = []

[dependencies]
indenter = { workspace = true }
once_cell = { workspace = true }
pyo3 = { version = "0.20", optional = true, default-features = false }

[build-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions eyre/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ pub use eyre as format_err;
/// Compatibility re-export of `eyre` for interop with `anyhow`
#[cfg(feature = "anyhow")]
pub use eyre as anyhow;
use once_cell::sync::OnceCell;
use ptr::OwnedPtr;
use std::sync::OnceLock;
#[cfg(feature = "anyhow")]
#[doc(hidden)]
pub use DefaultHandler as DefaultContext;
Expand Down Expand Up @@ -485,7 +485,7 @@ pub struct Report {
type ErrorHook =
Box<dyn Fn(&(dyn StdError + 'static)) -> Box<dyn EyreHandler> + Sync + Send + 'static>;

static HOOK: OnceCell<ErrorHook> = OnceCell::new();
static HOOK: OnceLock<ErrorHook> = OnceLock::new();

/// Error indicating that `set_hook` was unable to install the provided ErrorHook
#[derive(Debug, Clone, Copy)]
Expand Down

0 comments on commit b4805ed

Please sign in to comment.