Skip to content

Commit a40af83

Browse files
Cleanup utils
1 parent 8394408 commit a40af83

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/bootstrap/util.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//! not a lot of interesting happenings here unfortunately.
1515
1616
use std::env;
17-
use std::ffi::OsString;
1817
use std::fs;
1918
use std::io::{self, Write};
2019
use std::path::{Path, PathBuf};
@@ -32,16 +31,9 @@ pub fn staticlib(name: &str, target: &str) -> String {
3231
}
3332
}
3433

35-
/// Copies a file from `src` to `dst`, attempting to use hard links and then
36-
/// falling back to an actually filesystem copy if necessary.
34+
/// Copies a file from `src` to `dst`
3735
pub fn copy(src: &Path, dst: &Path) {
38-
// A call to `hard_link` will fail if `dst` exists, so remove it if it
39-
// already exists so we can try to help `hard_link` succeed.
4036
let _ = fs::remove_file(&dst);
41-
42-
// Attempt to "easy copy" by creating a hard link (symlinks don't work on
43-
// windows), but if that fails just fall back to a slow `copy` operation.
44-
// let res = fs::hard_link(src, dst);
4537
let res = fs::copy(src, dst);
4638
if let Err(e) = res {
4739
panic!("failed to copy `{}` to `{}`: {}", src.display(),
@@ -149,8 +141,7 @@ pub fn dylib_path_var() -> &'static str {
149141
/// Parses the `dylib_path_var()` environment variable, returning a list of
150142
/// paths that are members of this lookup path.
151143
pub fn dylib_path() -> Vec<PathBuf> {
152-
env::split_paths(&env::var_os(dylib_path_var()).unwrap_or(OsString::new()))
153-
.collect()
144+
env::split_paths(&env::var_os(dylib_path_var()).unwrap_or_default()).collect()
154145
}
155146

156147
/// `push` all components to `buf`. On windows, append `.exe` to the last component.
@@ -422,4 +413,4 @@ impl CiEnv {
422413
cmd.env("TERM", "xterm").args(&["--color", "always"]);
423414
}
424415
}
425-
}
416+
}

0 commit comments

Comments
 (0)