summaryrefslogtreecommitdiffstats
path: root/tests/testsuite/common.rs
diff options
context:
space:
mode:
authorNeil Kistner <neil.kistner@gmail.com>2019-09-09 18:14:38 -0500
committerMatan Kushner <hello@matchai.me>2019-09-09 19:14:38 -0400
commit9f70ffb7a7d2eeef64c360c553e909d38e44adf0 (patch)
tree4dccf8a935e027dcf7bc77781eed1554a645d72a /tests/testsuite/common.rs
parentdc8409333e194624896c74c5e5cdb4f664f53f9d (diff)
fix: Lazy load git repo and only run module if not disabled (#306)
A couple of optimizations are done in this PR. One, we now will check config ahead of time to see if a module is disabled before running any module code. Also, we won't try to discover a git repository unless the module requests access to it.
Diffstat (limited to 'tests/testsuite/common.rs')
-rw-r--r--tests/testsuite/common.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/testsuite/common.rs b/tests/testsuite/common.rs
index babe43a17..e06f5af43 100644
--- a/tests/testsuite/common.rs
+++ b/tests/testsuite/common.rs
@@ -1,15 +1,12 @@
-use lazy_static::lazy_static;
+use once_cell::sync::Lazy;
use std::io::prelude::*;
use std::io::{Error, ErrorKind};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, fs, io, process};
-lazy_static! {
- static ref MANIFEST_DIR: &'static Path = Path::new(env!("CARGO_MANIFEST_DIR"));
- pub static ref FIXTURES_DIR: PathBuf = MANIFEST_DIR.join("tests/fixtures");
- static ref EMPTY_CONFIG: PathBuf = MANIFEST_DIR.join("empty_config.toml");
-}
+static MANIFEST_DIR: Lazy<&'static Path> = Lazy::new(|| Path::new(env!("CARGO_MANIFEST_DIR")));
+static EMPTY_CONFIG: Lazy<PathBuf> = Lazy::new(|| MANIFEST_DIR.join("empty_config.toml"));
/// Render the full starship prompt
pub fn render_prompt() -> process::Command {