diff options
| author | est31 <MTest31@outlook.com> | 2020-10-09 11:23:40 +0200 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2020-10-14 04:14:32 +0200 |
| commit | 215cd36e1cff1806429806cb5be81f6d1a5f98b0 (patch) | |
| tree | 9c6b9c881228f080c9f932d2561d98a06c6c394b /compiler/rustc_fs_util/src | |
| parent | 58b3923ad377e79a0517ec15a672e3f8f90b10b4 (diff) | |
| download | rust-215cd36e1cff1806429806cb5be81f6d1a5f98b0.tar.gz rust-215cd36e1cff1806429806cb5be81f6d1a5f98b0.zip | |
Remove unused code from remaining compiler crates
Diffstat (limited to 'compiler/rustc_fs_util/src')
| -rw-r--r-- | compiler/rustc_fs_util/src/lib.rs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/compiler/rustc_fs_util/src/lib.rs b/compiler/rustc_fs_util/src/lib.rs index 289b9f30c3b..7742961e65d 100644 --- a/compiler/rustc_fs_util/src/lib.rs +++ b/compiler/rustc_fs_util/src/lib.rs @@ -75,33 +75,6 @@ pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<Li } } -#[derive(Debug)] -pub enum RenameOrCopyRemove { - Rename, - CopyRemove, -} - -/// Rename `p` into `q`, preferring to use `rename` if possible. -/// If `rename` fails (rename may fail for reasons such as crossing -/// filesystem), fallback to copy & remove -pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>( - p: P, - q: Q, -) -> io::Result<RenameOrCopyRemove> { - let p = p.as_ref(); - let q = q.as_ref(); - match fs::rename(p, q) { - Ok(()) => Ok(RenameOrCopyRemove::Rename), - Err(_) => match fs::copy(p, q) { - Ok(_) => { - fs::remove_file(p)?; - Ok(RenameOrCopyRemove::CopyRemove) - } - Err(e) => Err(e), - }, - } -} - #[cfg(unix)] pub fn path_to_c_string(p: &Path) -> CString { use std::ffi::OsStr; |
