Formatting

This commit is contained in:
Sam Hedin 2020-06-06 12:19:20 +02:00
parent 3c3ee08ffe
commit 03febb8cab

View File

@ -96,17 +96,21 @@ impl DirectorySpecificEnvironment {
keys_in_current_nufile.push(k.clone()); //this is used to keep track of which directory added which variables keys_in_current_nufile.push(k.clone()); //this is used to keep track of which directory added which variables
} }
self.overwritten_env_values.insert( //If we are about to overwrite any environment variables, we save them first so they can be restored later. self.overwritten_env_values.insert(
//If we are about to overwrite any environment variables, we save them first so they can be restored later.
wdir.to_path_buf(), wdir.to_path_buf(),
keys_in_current_nufile.iter().fold(vec![], |mut keyvals, key| { keys_in_current_nufile
if let Some(val) = std::env::var_os(key) { .iter()
keyvals.push((key.clone(), val)); .fold(vec![], |mut keyvals, key| {
} if let Some(val) = std::env::var_os(key) {
keyvals keyvals.push((key.clone(), val));
}), }
keyvals
}),
); );
self.added_env_vars.insert(wdir.to_path_buf(), keys_in_current_nufile); self.added_env_vars
.insert(wdir.to_path_buf(), keys_in_current_nufile);
break; break;
} else { } else {
working_dir = working_dir.unwrap().parent(); working_dir = working_dir.unwrap().parent();