Skip to content

Commit de79a6c

Browse files
committed
run-make: make arg take AsRef<OsStr> instead of str
1 parent 65df93b commit de79a6c

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/tools/run-make-support/src/rustdoc.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::env;
2+
use std::ffi::OsStr;
23
use std::path::Path;
34
use std::process::{Command, Output};
45

@@ -58,18 +59,12 @@ impl Rustdoc {
5859
self
5960
}
6061

61-
/// Fallback argument provider. Consider adding meaningfully named methods instead of using
62-
/// this method.
63-
pub fn arg(&mut self, arg: &str) -> &mut Self {
62+
/// Generic command argument provider. Use `.arg("-Zname")` over `.arg("-Z").arg("arg")`.
63+
pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self {
6464
self.cmd.arg(arg);
6565
self
6666
}
6767

68-
pub fn arg_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
69-
self.cmd.arg(path.as_ref());
70-
self
71-
}
72-
7368
/// Run the build `rustdoc` command and assert that the run is successful.
7469
#[track_caller]
7570
pub fn run(&mut self) -> Output {

tests/run-make/exit-code/rmake.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ fn main() {
2525

2626
rustdoc()
2727
.arg("success.rs")
28-
.arg("-o").arg_path(tmp_dir().join("exit-code"))
28+
.arg("-o")
29+
.arg(tmp_dir().join("exit-code"))
2930
.run();
3031

3132
rustdoc()

0 commit comments

Comments
 (0)