diff options
Diffstat (limited to 'src/git')
-rw-r--r-- | src/git/ignore.rs | 6 | ||||
-rw-r--r-- | src/git/status_computer.rs | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/git/ignore.rs b/src/git/ignore.rs index f3f267e..4c6558e 100644 --- a/src/git/ignore.rs +++ b/src/git/ignore.rs @@ -4,8 +4,8 @@ use { git2, glob, id_arena::{Arena, Id}, - lazy_static::lazy_static, lazy_regex::regex, + once_cell::sync::Lazy, std::{ fs::File, io::{BufRead, BufReader, Result}, @@ -97,9 +97,7 @@ impl GitIgnoreFile { /// return the global gitignore file interpreted for /// the given repo dir pub fn global(repo_dir: &Path) -> Option<GitIgnoreFile> { - lazy_static! { - static ref GLOBAL_GI_PATH: Option<PathBuf> = find_global_ignore(); - } + static GLOBAL_GI_PATH: Lazy<Option<PathBuf>> = Lazy::new(find_global_ignore); if let Some(path) = &*GLOBAL_GI_PATH { GitIgnoreFile::new(path, repo_dir).ok() } else { diff --git a/src/git/status_computer.rs b/src/git/status_computer.rs index 8cb1528..bb6bdc7 100644 --- a/src/git/status_computer.rs +++ b/src/git/status_computer.rs @@ -7,7 +7,7 @@ use { crossbeam::channel::bounded, ahash::AHashMap, git2::Repository, - lazy_static::lazy_static, + once_cell::sync::Lazy, std::{ path::{Path, PathBuf}, sync::Mutex, @@ -30,11 +30,10 @@ fn compute_tree_status(root_path: &Path) -> ComputationResult<TreeGitStatus> { } } -lazy_static! { // the key is the path of the repository - static ref TS_CACHE_MX: Mutex<AHashMap<PathBuf, Computation<TreeGitStatus>>> = - Mutex::new(AHashMap::default()); -} +static TS_CACHE_MX: Lazy<Mutex<AHashMap<PathBuf, Computation<TreeGitStatus>>>> = Lazy::new(|| { + Mutex::new(AHashMap::default()) +}); /// try to get the result of the computation of the tree git status. /// This may be immediate if a previous computation was finished. |