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
|
@ -10,4 +10,3 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
gpui.workspace = true
|
||||
once_cell.workspace = true
|
||||
|
|
|
@ -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),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue