Skip to content

Commit 5a21f42

Browse files
committed
run rustfmt for librustc/util/fs.rs
1 parent 768f6a9 commit 5a21f42

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/librustc/util/fs.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use std::io;
3131
// https://github.com/rust-lang/rust/issues/25505#issuecomment-102876737
3232
pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf {
3333
if !cfg!(windows) {
34-
return p.to_path_buf()
34+
return p.to_path_buf();
3535
}
3636
let mut components = p.components();
3737
let prefix = match components.next() {
@@ -58,7 +58,7 @@ pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf {
5858

5959
pub enum LinkOrCopy {
6060
Link,
61-
Copy
61+
Copy,
6262
}
6363

6464
/// 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
7676
Err(_) => {
7777
match fs::copy(p, q) {
7878
Ok(_) => Ok(LinkOrCopy::Copy),
79-
Err(e) => Err(e)
79+
Err(e) => Err(e),
8080
}
8181
}
8282
}
@@ -85,12 +85,15 @@ pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<Li
8585
#[derive(Debug)]
8686
pub enum RenameOrCopyRemove {
8787
Rename,
88-
CopyRemove
88+
CopyRemove,
8989
}
9090

9191
/// Rename `p` into `q`, preferring to use `rename` if possible.
92-
/// If `rename` fails (rename may fail for reasons such as crossing filesystem), fallback to copy & remove
93-
pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<RenameOrCopyRemove> {
92+
/// If `rename` fails (rename may fail for reasons such as crossing
93+
/// filesystem), fallback to copy & remove
94+
pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P,
95+
q: Q)
96+
-> io::Result<RenameOrCopyRemove> {
9497
let p = p.as_ref();
9598
let q = q.as_ref();
9699
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::
100103
Ok(_) => {
101104
fs::remove_file(p)?;
102105
Ok(RenameOrCopyRemove::CopyRemove)
103-
},
104-
Err(e) => Err(e)
106+
}
107+
Err(e) => Err(e),
105108
}
106109
}
107110
}
@@ -118,8 +121,7 @@ pub fn create_dir_racy(path: &Path) -> io::Result<()> {
118121
}
119122
match path.parent() {
120123
Some(p) => try!(create_dir_racy(p)),
121-
None => return Err(io::Error::new(io::ErrorKind::Other,
122-
"failed to create whole tree")),
124+
None => return Err(io::Error::new(io::ErrorKind::Other, "failed to create whole tree")),
123125
}
124126
match fs::create_dir(path) {
125127
Ok(()) => Ok(()),

0 commit comments

Comments
 (0)