on master help sign in
Run 'cargo fmt'
f5c1cb2Martin Nordholts
src/bin/bat/directories.rs+3−3
@@ -15,11 +15,11 @@ pub struct BatProjectDirs {
15impl BatProjectDirs {
15impl BatProjectDirs {
16 fn new() -> Option<BatProjectDirs> {
16 fn new() -> Option<BatProjectDirs> {
17 let cache_dir = BatProjectDirs::get_cache_dir()?;
17 let cache_dir = BatProjectDirs::get_cache_dir()?;
18−
18+
19 // Checks whether or not $BAT_CONFIG_DIR exists. If it doesn't, set our config dir
19 // Checks whether or not $BAT_CONFIG_DIR exists. If it doesn't, set our config dir
20 // to our system's default configuration home.
20 // to our system's default configuration home.
21+ let config_dir =
21− let config_dir = if let Some(config_dir_op) = env::var_os("BAT_CONFIG_DIR")
22+ if let Some(config_dir_op) = env::var_os("BAT_CONFIG_DIR").map(PathBuf::from) {
22− .map(PathBuf::from) {
23 config_dir_op
23 config_dir_op
24 } else {
24 } else {
25 #[cfg(target_os = "macos")]
25 #[cfg(target_os = "macos")]
tests/integration_tests.rs+1−4
@@ -755,10 +755,7 @@ fn config_location_from_bat_config_dir_variable() {
755 .arg("--config-file")
755 .arg("--config-file")
756 .assert()
756 .assert()
757 .success()
757 .success()
758− .stdout(
759− predicate::str::is_match("conf/config\n")
758+ .stdout(predicate::str::is_match("conf/config\n").unwrap());
760− .unwrap()
761− );
762}
759}
763
760
764#[test]
761#[test]