chore: Remove explicit usages of once_cell in favor of std (#22407)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
45c714110e
commit
1a9f0a647a
8 changed files with 19 additions and 23 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -2484,7 +2484,6 @@ dependencies = [
|
||||||
"exec",
|
"exec",
|
||||||
"fork",
|
"fork",
|
||||||
"ipc-channel",
|
"ipc-channel",
|
||||||
"once_cell",
|
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"paths",
|
"paths",
|
||||||
"plist",
|
"plist",
|
||||||
|
@ -2511,7 +2510,6 @@ dependencies = [
|
||||||
"gpui",
|
"gpui",
|
||||||
"http_client",
|
"http_client",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"paths",
|
"paths",
|
||||||
"postage",
|
"postage",
|
||||||
|
@ -10266,7 +10264,6 @@ name = "release_channel"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gpui",
|
"gpui",
|
||||||
"once_cell",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -408,7 +408,6 @@ nanoid = "0.4"
|
||||||
nbformat = { version = "0.9.0" }
|
nbformat = { version = "0.9.0" }
|
||||||
nix = "0.29"
|
nix = "0.29"
|
||||||
num-format = "0.4.4"
|
num-format = "0.4.4"
|
||||||
once_cell = "1.19.0"
|
|
||||||
ordered-float = "2.1.1"
|
ordered-float = "2.1.1"
|
||||||
palette = { version = "0.7.5", default-features = false, features = ["std"] }
|
palette = { version = "0.7.5", default-features = false, features = ["std"] }
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
|
|
|
@ -25,7 +25,6 @@ anyhow.workspace = true
|
||||||
clap.workspace = true
|
clap.workspace = true
|
||||||
collections.workspace = true
|
collections.workspace = true
|
||||||
ipc-channel = "0.19"
|
ipc-channel = "0.19"
|
||||||
once_cell.workspace = true
|
|
||||||
parking_lot.workspace = true
|
parking_lot.workspace = true
|
||||||
paths.workspace = true
|
paths.workspace = true
|
||||||
release_channel.workspace = true
|
release_channel.workspace = true
|
||||||
|
|
|
@ -277,6 +277,7 @@ mod linux {
|
||||||
os::unix::net::{SocketAddr, UnixDatagram},
|
os::unix::net::{SocketAddr, UnixDatagram},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::{self, ExitStatus},
|
process::{self, ExitStatus},
|
||||||
|
sync::LazyLock,
|
||||||
thread,
|
thread,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
@ -284,12 +285,11 @@ mod linux {
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use cli::FORCE_CLI_MODE_ENV_VAR_NAME;
|
use cli::FORCE_CLI_MODE_ENV_VAR_NAME;
|
||||||
use fork::Fork;
|
use fork::Fork;
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
|
|
||||||
use crate::{Detect, InstalledApp};
|
use crate::{Detect, InstalledApp};
|
||||||
|
|
||||||
static RELEASE_CHANNEL: Lazy<String> =
|
static RELEASE_CHANNEL: LazyLock<String> =
|
||||||
Lazy::new(|| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string());
|
LazyLock::new(|| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string());
|
||||||
|
|
||||||
struct App(PathBuf);
|
struct App(PathBuf);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ futures.workspace = true
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
http_client.workspace = true
|
http_client.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
once_cell.workspace = true
|
|
||||||
paths.workspace = true
|
paths.workspace = true
|
||||||
parking_lot.workspace = true
|
parking_lot.workspace = true
|
||||||
postage.workspace = true
|
postage.workspace = true
|
||||||
|
|
|
@ -8,7 +8,6 @@ use futures::channel::mpsc;
|
||||||
use futures::{Future, StreamExt};
|
use futures::{Future, StreamExt};
|
||||||
use gpui::{AppContext, BackgroundExecutor, Task};
|
use gpui::{AppContext, BackgroundExecutor, Task};
|
||||||
use http_client::{self, AsyncBody, HttpClient, HttpClientWithUrl, Method, Request};
|
use http_client::{self, AsyncBody, HttpClient, HttpClientWithUrl, Method, Request};
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use release_channel::ReleaseChannel;
|
use release_channel::ReleaseChannel;
|
||||||
use settings::{Settings, SettingsStore};
|
use settings::{Settings, SettingsStore};
|
||||||
|
@ -16,7 +15,12 @@ use sha2::{Digest, Sha256};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::{env, mem, path::PathBuf, sync::Arc, time::Duration};
|
use std::{
|
||||||
|
env, mem,
|
||||||
|
path::PathBuf,
|
||||||
|
sync::{Arc, LazyLock},
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
use telemetry_events::{
|
use telemetry_events::{
|
||||||
AppEvent, AssistantEvent, CallEvent, EditEvent, Event, EventRequestBody, EventWrapper,
|
AppEvent, AssistantEvent, CallEvent, EditEvent, Event, EventRequestBody, EventWrapper,
|
||||||
InlineCompletionEvent,
|
InlineCompletionEvent,
|
||||||
|
@ -84,7 +88,7 @@ const FLUSH_INTERVAL: Duration = Duration::from_secs(1);
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
const FLUSH_INTERVAL: Duration = Duration::from_secs(60 * 5);
|
const FLUSH_INTERVAL: Duration = Duration::from_secs(60 * 5);
|
||||||
static ZED_CLIENT_CHECKSUM_SEED: Lazy<Option<Vec<u8>>> = Lazy::new(|| {
|
static ZED_CLIENT_CHECKSUM_SEED: LazyLock<Option<Vec<u8>>> = LazyLock::new(|| {
|
||||||
option_env!("ZED_CLIENT_CHECKSUM_SEED")
|
option_env!("ZED_CLIENT_CHECKSUM_SEED")
|
||||||
.map(|s| s.as_bytes().into())
|
.map(|s| s.as_bytes().into())
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
|
|
|
@ -10,4 +10,3 @@ workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
once_cell.workspace = true
|
|
||||||
|
|
|
@ -2,24 +2,23 @@
|
||||||
|
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use std::{env, str::FromStr};
|
use std::{env, str::FromStr, sync::LazyLock};
|
||||||
|
|
||||||
use gpui::{AppContext, Global, SemanticVersion};
|
use gpui::{AppContext, Global, SemanticVersion};
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
|
|
||||||
/// stable | dev | nightly | preview
|
/// stable | dev | nightly | preview
|
||||||
pub static RELEASE_CHANNEL_NAME: Lazy<String> = if cfg!(debug_assertions) {
|
pub static RELEASE_CHANNEL_NAME: LazyLock<String> = LazyLock::new(|| {
|
||||||
Lazy::new(|| {
|
if cfg!(debug_assertions) {
|
||||||
env::var("ZED_RELEASE_CHANNEL")
|
env::var("ZED_RELEASE_CHANNEL")
|
||||||
.unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string())
|
.unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string())
|
||||||
})
|
} else {
|
||||||
} else {
|
include_str!("../../zed/RELEASE_CHANNEL").trim().to_string()
|
||||||
Lazy::new(|| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string())
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub static RELEASE_CHANNEL: Lazy<ReleaseChannel> =
|
pub static RELEASE_CHANNEL: LazyLock<ReleaseChannel> =
|
||||||
Lazy::new(|| match ReleaseChannel::from_str(&RELEASE_CHANNEL_NAME) {
|
LazyLock::new(|| match ReleaseChannel::from_str(&RELEASE_CHANNEL_NAME) {
|
||||||
Ok(channel) => channel,
|
Ok(channel) => channel,
|
||||||
_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),
|
_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue