From 9db3853c9c6e91c403e17a001489e15e2cb7ce71 Mon Sep 17 00:00:00 2001 From: Ethan Donowitz Date: Tue, 23 Apr 2024 17:38:14 -0400 Subject: [PATCH] treewide: Remove once_cell crate `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 --- Cargo.lock | 2 -- Cargo.toml | 1 - readyset-server/Cargo.toml | 1 - readyset-server/src/metrics/mod.rs | 5 +++-- readyset-tracing/Cargo.toml | 1 - 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f05f7f1d49..b6e208396d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4960,7 +4960,6 @@ dependencies = [ "nom", "nom-sql", "num_cpus", - "once_cell", "parking_lot 0.12.1", "petgraph", "pin-project", @@ -5076,7 +5075,6 @@ version = "0.1.0" dependencies = [ "clap 4.3.2", "lazy_static", - "once_cell", "opentelemetry", "opentelemetry-otlp", "opentelemetry-semantic-conventions", diff --git a/Cargo.toml b/Cargo.toml index a69f782c39..37ad4a09c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/readyset-server/Cargo.toml b/readyset-server/Cargo.toml index 32670f4f01..49f1387196 100644 --- a/readyset-server/Cargo.toml +++ b/readyset-server/Cargo.toml @@ -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 } diff --git a/readyset-server/src/metrics/mod.rs b/readyset-server/src/metrics/mod.rs index 36e1f6211f..8c1ad80dc5 100644 --- a/readyset-server/src/metrics/mod.rs +++ b/readyset-server/src/metrics/mod.rs @@ -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}; @@ -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. /// diff --git a/readyset-tracing/Cargo.toml b/readyset-tracing/Cargo.toml index 9f588d069d..d108eeeaf4 100644 --- a/readyset-tracing/Cargo.toml +++ b/readyset-tracing/Cargo.toml @@ -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"] }