diff options
| author | king6cong <king6cong@gmail.com> | 2017-02-04 10:21:26 +0800 |
|---|---|---|
| committer | king6cong <king6cong@gmail.com> | 2017-02-04 10:37:09 +0800 |
| commit | 5a21f42cb7f193663fa7a3e95f27e4bf805b5be2 (patch) | |
| tree | 09a7dc87cc888d1539fb352defa481d01832f736 | |
| parent | 768f6a9b57c83030919adb30565918f1b520596f (diff) | |
| download | rust-5a21f42cb7f193663fa7a3e95f27e4bf805b5be2.tar.gz rust-5a21f42cb7f193663fa7a3e95f27e4bf805b5be2.zip | |
run rustfmt for librustc/util/fs.rs
| -rw-r--r-- | src/librustc/util/fs.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/librustc/util/fs.rs b/src/librustc/util/fs.rs index 7f8a69de607..3b4b3998c57 100644 --- a/src/librustc/util/fs.rs +++ b/src/librustc/util/fs.rs @@ -31,7 +31,7 @@ use std::io; // https://github.com/rust-lang/rust/issues/25505#issuecomment-102876737 pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf { if !cfg!(windows) { - return p.to_path_buf() + return p.to_path_buf(); } let mut components = p.components(); let prefix = match components.next() { @@ -58,7 +58,7 @@ pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf { pub enum LinkOrCopy { Link, - Copy + Copy, } /// Copy `p` into `q`, preferring to use hard-linking if possible. If @@ -76,7 +76,7 @@ pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<Li Err(_) => { match fs::copy(p, q) { Ok(_) => Ok(LinkOrCopy::Copy), - Err(e) => Err(e) + Err(e) => Err(e), } } } @@ -85,12 +85,15 @@ 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 + 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> { +/// 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) { @@ -100,8 +103,8 @@ pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io:: Ok(_) => { fs::remove_file(p)?; Ok(RenameOrCopyRemove::CopyRemove) - }, - Err(e) => Err(e) + } + Err(e) => Err(e), } } } @@ -118,8 +121,7 @@ pub fn create_dir_racy(path: &Path) -> io::Result<()> { } match path.parent() { Some(p) => try!(create_dir_racy(p)), - None => return Err(io::Error::new(io::ErrorKind::Other, - "failed to create whole tree")), + None => return Err(io::Error::new(io::ErrorKind::Other, "failed to create whole tree")), } match fs::create_dir(path) { Ok(()) => Ok(()), |
