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:
parent
41180b8d81
commit
01b836a191
6 changed files with 29 additions and 24 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue