Skip to content

Commit c1a138c

Browse files
committed
Auto merge of #5316 - lzutao:osstr, r=phansch
Don't convert Path to lossy str changelog: none
2 parents 8fd7e31 + 9febcf5 commit c1a138c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

tests/integration.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg(feature = "integration")]
22

33
use std::env;
4+
use std::ffi::OsStr;
45
use std::process::Command;
56

67
#[cfg_attr(feature = "integration", test)]
@@ -12,13 +13,16 @@ fn integration_test() {
1213
.nth(1)
1314
.expect("repo name should have format `<org>/<name>`");
1415

15-
let repo_dir = tempfile::tempdir()
16-
.expect("couldn't create temp dir")
17-
.path()
18-
.join(crate_name);
16+
let mut repo_dir = tempfile::tempdir().expect("couldn't create temp dir").into_path();
17+
repo_dir.push(crate_name);
1918

2019
let st = Command::new("git")
21-
.args(&["clone", "--depth=1", &repo_url, repo_dir.to_str().unwrap()])
20+
.args(&[
21+
OsStr::new("clone"),
22+
OsStr::new("--depth=1"),
23+
OsStr::new(&repo_url),
24+
OsStr::new(&repo_dir),
25+
])
2226
.status()
2327
.expect("unable to run git");
2428
assert!(st.success());
@@ -68,13 +72,8 @@ fn integration_test() {
6872
}
6973

7074
match output.status.code() {
71-
Some(code) => {
72-
if code == 0 {
73-
println!("Compilation successful");
74-
} else {
75-
eprintln!("Compilation failed. Exit code: {}", code);
76-
}
77-
},
75+
Some(0) => println!("Compilation successful"),
76+
Some(code) => eprintln!("Compilation failed. Exit code: {}", code),
7877
None => panic!("Process terminated by signal"),
7978
}
8079
}

0 commit comments

Comments
 (0)