util: Replace lazy_static! with OnceLock (#13215)

This PR replaces the `lazy_static!` usages in the `util` crate with
`OnceLock` from the standard library.

This allows us to drop the `lazy_static` dependency from this crate.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-06-18 12:44:58 -04:00 committed by GitHub
parent 41180b8d81
commit 01b836a191
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 29 additions and 24 deletions

View file

@ -58,7 +58,7 @@ use std::{
};
use sum_tree::{Bias, Edit, SeekTarget, SumTree, TreeMap, TreeSet};
use text::{LineEnding, Rope};
use util::{paths::HOME, ResultExt};
use util::{paths::home_dir, ResultExt};
pub use worktree_settings::WorktreeSettings;
#[cfg(feature = "test-support")]
@ -2968,9 +2968,9 @@ impl language::File for File {
} else {
let path = worktree.abs_path();
if worktree.is_local() && path.starts_with(HOME.as_path()) {
if worktree.is_local() && path.starts_with(home_dir().as_path()) {
full_path.push("~");
full_path.push(path.strip_prefix(HOME.as_path()).unwrap());
full_path.push(path.strip_prefix(home_dir().as_path()).unwrap());
} else {
full_path.push(path)
}