chore: Remove explicit usages of once_cell in favor of std (#22407)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-12-25 01:33:26 +01:00 committed by GitHub
parent 45c714110e
commit 1a9f0a647a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 19 additions and 23 deletions

View file

@ -10,4 +10,3 @@ workspace = true
[dependencies]
gpui.workspace = true
once_cell.workspace = true

View file

@ -2,24 +2,23 @@
#![deny(missing_docs)]
use std::{env, str::FromStr};
use std::{env, str::FromStr, sync::LazyLock};
use gpui::{AppContext, Global, SemanticVersion};
use once_cell::sync::Lazy;
/// stable | dev | nightly | preview
pub static RELEASE_CHANNEL_NAME: Lazy<String> = if cfg!(debug_assertions) {
Lazy::new(|| {
pub static RELEASE_CHANNEL_NAME: LazyLock<String> = LazyLock::new(|| {
if cfg!(debug_assertions) {
env::var("ZED_RELEASE_CHANNEL")
.unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string())
})
} else {
Lazy::new(|| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string())
};
} else {
include_str!("../../zed/RELEASE_CHANNEL").trim().to_string()
}
});
#[doc(hidden)]
pub static RELEASE_CHANNEL: Lazy<ReleaseChannel> =
Lazy::new(|| match ReleaseChannel::from_str(&RELEASE_CHANNEL_NAME) {
pub static RELEASE_CHANNEL: LazyLock<ReleaseChannel> =
LazyLock::new(|| match ReleaseChannel::from_str(&RELEASE_CHANNEL_NAME) {
Ok(channel) => channel,
_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),
});