Skip to content

Commit

Permalink
treewide: Remove once_cell crate
Browse files Browse the repository at this point in the history
`OnceCell` was added to the Rust standard library a while back, so it is
no longer necessary to use the 3rd party crate. This commit removes the
crate, replacing our only usage of `OnceCell` with `OnceLock`, which is
a thread-safe alternative.

Change-Id: Ifdb622c34c24ff40836276e25d2db8c33a2694df
  • Loading branch information
ethowitz committed Apr 26, 2024
1 parent 86a162b commit 2454beb
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 7 deletions.
2 changes: 0 additions & 2 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 @@ -153,7 +153,6 @@ nom_locate = "4.0.0"
notify = "6.1.1"
num-integer = "0.1.44"
num_cpus = "1.16.0"
once_cell = "1.14"
opentelemetry = "0.21.0"
opentelemetry-otlp = "0.14.0"
opentelemetry-semantic-conventions = "0.13"
Expand Down
1 change: 0 additions & 1 deletion readyset-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ sha1 = { workspace = true }
derive_more = { workspace = true }
streaming-iterator = { workspace = true }
proptest = { workspace = true }
once_cell = { workspace = true }
enum-kinds = { workspace = true }
slotmap = { workspace = true }
tikv-jemalloc-ctl = { workspace = true }
Expand Down
5 changes: 3 additions & 2 deletions readyset-server/src/metrics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Support for recording and exporting in-memory metrics using the [`metrics`] crate

use once_cell::sync::OnceCell;
use std::sync::OnceLock;

use thiserror::Error;

pub use crate::metrics::composite_recorder::{CompositeMetricsRecorder, RecorderType};
Expand All @@ -14,7 +15,7 @@ mod recorders;

/// The type of the static, globally accessible metrics recorder.
type GlobalRecorder = CompositeMetricsRecorder;
static METRICS_RECORDER: OnceCell<&'static GlobalRecorder> = OnceCell::new();
static METRICS_RECORDER: OnceLock<&'static GlobalRecorder> = OnceLock::new();

/// Error value returned from [`install_global_recorder`] if a metrics recorder is already set.
///
Expand Down
1 change: 0 additions & 1 deletion readyset-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"

[dependencies]
clap = { workspace = true, features = ["derive","env"] }
once_cell = { workspace = true }
parking_lot = { workspace = true }
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] }
Expand Down

0 comments on commit 2454beb

Please sign in to comment.