Replace lazy_static with std::sync::LazyLock (#16066)

Closes #15860 

Since rust std now supports LazyLock replacing lazy_static with it
reduce the external dependency.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
Sinan Gençoğlu 2024-08-20 20:27:33 +02:00 committed by GitHub
parent 85731dfe8e
commit ff7017c308
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 160 additions and 195 deletions

View file

@ -20,7 +20,6 @@ derive_more.workspace = true
git2.workspace = true
gpui.workspace = true
http_client.workspace = true
lazy_static.workspace = true
log.workspace = true
parking_lot.workspace = true
rope.workspace = true

View file

@ -5,9 +5,9 @@ use serde::{Deserialize, Serialize};
use std::ffi::OsStr;
use std::fmt;
use std::str::FromStr;
use std::sync::LazyLock;
pub use git2 as libgit;
pub use lazy_static::lazy_static;
pub use crate::hosting_provider::*;
@ -17,10 +17,8 @@ pub mod diff;
pub mod repository;
pub mod status;
lazy_static! {
pub static ref DOT_GIT: &'static OsStr = OsStr::new(".git");
pub static ref GITIGNORE: &'static OsStr = OsStr::new(".gitignore");
}
pub static DOT_GIT: LazyLock<&'static OsStr> = LazyLock::new(|| OsStr::new(".git"));
pub static GITIGNORE: LazyLock<&'static OsStr> = LazyLock::new(|| OsStr::new(".gitignore"));
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
pub struct Oid(libgit::Oid);