Skip to content

Commit 27a378f

Browse files
committed
Don't repeat turning path into a String
1 parent 1ae5da1 commit 27a378f

File tree

1 file changed

+4
-6
lines changed
  • src/tools/run-make-support/src/external_deps

1 file changed

+4
-6
lines changed

src/tools/run-make-support/src/external_deps/cygpath.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ pub fn get_windows_path<P: AsRef<Path>>(path: P) -> String {
2727
cygpath.arg("-w");
2828
cygpath.arg(path.as_ref());
2929
let output = cygpath.run();
30-
if !output.status().success() {
31-
return path.as_ref().to_str().unwrap().into();
30+
if output.status().success() {
31+
// cygpath -w can attach a newline
32+
return output.stdout_utf8().trim().to_string();
3233
}
33-
// cygpath -w can attach a newline
34-
output.stdout_utf8().trim().to_string()
35-
} else {
36-
path.as_ref().to_str().unwrap().into()
3734
}
35+
path.as_ref().to_str().unwrap().into()
3836
}

0 commit comments

Comments
 (0)