Simplify append_interpreter_and_path function a bit
Renames a variable for clarity and removes unnecessary type hinting /
transformations.
@@ -141,14 +141,14 @@ pub fn interpreter_paths() -> Result<Vec<PathBuf>> {
Ok(interpreter_paths)
}
-pub fn append_interpreter_and_path(orig_paths: &mut Vec<PathBuf>) -> Result<String> {
- let mut paths = interpreter_paths()?.to_owned();
- orig_paths.append(&mut paths);
+pub fn append_interpreter_and_path(path_entries: &mut Vec<PathBuf>) -> Result<String> {
+ let mut paths = interpreter_paths()?;
+ path_entries.append(&mut paths);
if let Some(val) = env::var_os("PATH") {
- let mut os_paths = env::split_paths(&val).collect::<Vec<PathBuf>>();
- orig_paths.append(&mut os_paths);
+ let mut os_paths = env::split_paths(&val).collect();
+ path_entries.append(&mut os_paths);
}
- let joined = env::join_paths(orig_paths)?;
+ let joined = env::join_paths(path_entries)?;
let path_str = joined.into_string().expect(
"Unable to convert OsStr path to string!",
);
