Skip to content

Commit aedc094

Browse files
committed
Merge branch 'issue-2848' of github.com:chansuke/rustup into issue-2848
2 parents fdada6f + 91620e8 commit aedc094

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Diff for: src/env_var.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,10 @@ fn append_path<E: ProcessEnvs>(name: &str, value: Vec<PathBuf>, cmd: &mut E) {
4646

4747
pub(crate) fn prepend_path<E: ProcessEnvs>(name: &str, prepend: Vec<PathBuf>, cmd: &mut E) {
4848
let old_value = process().var_os(name);
49-
let parts = if let Some(ref v) = old_value {
50-
let mut tail = env::split_paths(v).collect::<VecDeque<_>>();
51-
for path in prepend.into_iter().rev() {
52-
if !tail.contains(&path) {
53-
tail.push_front(path);
54-
}
55-
}
56-
tail
49+
let parts: Vec<PathBuf>;
50+
if let Some(ref v) = old_value {
51+
let old_paths: Vec<PathBuf> = env::split_paths(v).collect::<Vec<_>>();
52+
parts = concat_uniq_paths(value, old_paths);
5753
} else {
5854
prepend.into()
5955
};

0 commit comments

Comments
 (0)