Skip to content

Commit

Permalink
Merge pull request #28998 from petrosagg/remove-once-cell
Browse files Browse the repository at this point in the history
remove `once_cell` in favor of `std::sync::LazyLock`
  • Loading branch information
petrosagg authored Aug 26, 2024
2 parents c7b5c41 + 2d8c853 commit 65f0874
Show file tree
Hide file tree
Showing 107 changed files with 1,470 additions and 1,496 deletions.
36 changes: 0 additions & 36 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 misc/bazel/cargo-gazelle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ cargo_toml = "0.19.1"
clap = { version = "3.2.24", features = ["derive"] }
convert_case = "0.6"
guppy = "0.17.5"
once_cell = "1.16.0"
proc-macro2 = "1.0.60"
protobuf-parse = "3.4.0"
quote = "1.0.23"
Expand Down
6 changes: 3 additions & 3 deletions misc/bazel/cargo-gazelle/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::borrow::Cow;
use std::collections::BTreeMap;

use guppy::graph::PackageMetadata;
use once_cell::sync::Lazy;
use std::sync::LazyLock;

use crate::targets::{AdditiveContent, RustTestSize};

Expand Down Expand Up @@ -117,12 +117,12 @@ impl CrateConfig {
}

pub fn test(&self, name: &str) -> &TestConfig {
static EMPTY_TEST: Lazy<TestConfig> = Lazy::new(TestConfig::default);
static EMPTY_TEST: LazyLock<TestConfig> = LazyLock::new(TestConfig::default);
self.tests.get(name).unwrap_or(&*EMPTY_TEST)
}

pub fn binary(&self, name: &str) -> &BinaryConfig {
static EMPTY_BINARY: Lazy<BinaryConfig> = Lazy::new(BinaryConfig::default);
static EMPTY_BINARY: LazyLock<BinaryConfig> = LazyLock::new(BinaryConfig::default);
self.binaries.get(name).unwrap_or(&*EMPTY_BINARY)
}
}
Expand Down
10 changes: 5 additions & 5 deletions misc/bazel/cargo-gazelle/src/platforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
use std::sync::Arc;

use guppy::platform::{Platform, PlatformSpec, TargetFeatures, Triple};
use once_cell::sync::Lazy;
use std::sync::LazyLock;

use crate::ToBazelDefinition;

static AARCH64_MAC_OS: Lazy<PlatformSpec> = Lazy::new(|| {
static AARCH64_MAC_OS: LazyLock<PlatformSpec> = LazyLock::new(|| {
let triple = Triple::new("aarch64-apple-darwin").unwrap();
PlatformSpec::Platform(Arc::new(Platform::from_triple(triple, TargetFeatures::All)))
});
static X86_64_MAC_OS: Lazy<PlatformSpec> = Lazy::new(|| {
static X86_64_MAC_OS: LazyLock<PlatformSpec> = LazyLock::new(|| {
let triple = Triple::new("x86_64-apple-darwin").unwrap();
PlatformSpec::Platform(Arc::new(Platform::from_triple(triple, TargetFeatures::All)))
});
static AARCH64_LINUX_GNU: Lazy<PlatformSpec> = Lazy::new(|| {
static AARCH64_LINUX_GNU: LazyLock<PlatformSpec> = LazyLock::new(|| {
let triple = Triple::new("aarch64-unknown-linux-gnu").unwrap();
PlatformSpec::Platform(Arc::new(Platform::from_triple(triple, TargetFeatures::All)))
});
static X86_64_LINUX_GNU: Lazy<PlatformSpec> = Lazy::new(|| {
static X86_64_LINUX_GNU: LazyLock<PlatformSpec> = LazyLock::new(|| {
let triple = Triple::new("x86_64-unknown-linux-gnu").unwrap();
PlatformSpec::Platform(Arc::new(Platform::from_triple(triple, TargetFeatures::All)))
});
Expand Down
1 change: 0 additions & 1 deletion src/adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ governor = "0.6.0"
hex = "0.4.3"
http = "1.1.0"
itertools = "0.10.5"
once_cell = "1.16.0"
launchdarkly-server-sdk = { version = "1.0.0", default-features = false, features = [
"hypertls",
] }
Expand Down
6 changes: 3 additions & 3 deletions src/adapter/src/catalog/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::collections::{BTreeMap, BTreeSet, VecDeque};
use std::fmt::Debug;
use std::net::Ipv4Addr;
use std::sync::Arc;
use std::sync::LazyLock;
use std::time::Instant;

use itertools::Itertools;
Expand Down Expand Up @@ -78,7 +79,6 @@ use mz_storage_types::connections::inline::{
ConnectionResolver, InlinedConnection, IntoInlineConnection,
};
use mz_storage_types::connections::ConnectionContext;
use once_cell::sync::Lazy;
use serde::Serialize;
use timely::progress::Antichain;
use tokio::sync::mpsc;
Expand Down Expand Up @@ -1642,9 +1642,9 @@ impl CatalogState {
name: &PartialItemName,
conn_id: &ConnectionId,
) -> Result<&CatalogEntry, SqlCatalogError> {
static NON_PG_CATALOG_TYPES: Lazy<
static NON_PG_CATALOG_TYPES: LazyLock<
BTreeMap<&'static str, &'static BuiltinType<NameReference>>,
> = Lazy::new(|| {
> = LazyLock::new(|| {
BUILTINS::types()
.filter(|typ| typ.schema != PG_CATALOG_SCHEMA)
.map(|typ| (typ.name, typ))
Expand Down
Loading

0 comments on commit 65f0874

Please sign in to comment.