run-make: make arg take AsRef<OsStr> instead of str
This commit is contained in:
parent
65df93bbb4
commit
de79a6c084
@ -1,4 +1,5 @@
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
use std::process::{Command, Output};
|
||||
|
||||
@ -58,18 +59,12 @@ pub fn arg_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
|
||||
self
|
||||
}
|
||||
|
||||
/// Fallback argument provider. Consider adding meaningfully named methods instead of using
|
||||
/// this method.
|
||||
pub fn arg(&mut self, arg: &str) -> &mut Self {
|
||||
/// Generic command argument provider. Use `.arg("-Zname")` over `.arg("-Z").arg("arg")`.
|
||||
pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self {
|
||||
self.cmd.arg(arg);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn arg_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
|
||||
self.cmd.arg(path.as_ref());
|
||||
self
|
||||
}
|
||||
|
||||
/// Run the build `rustdoc` command and assert that the run is successful.
|
||||
#[track_caller]
|
||||
pub fn run(&mut self) -> Output {
|
||||
|
@ -25,7 +25,8 @@ fn main() {
|
||||
|
||||
rustdoc()
|
||||
.arg("success.rs")
|
||||
.arg("-o").arg_path(tmp_dir().join("exit-code"))
|
||||
.arg("-o")
|
||||
.arg(tmp_dir().join("exit-code"))
|
||||
.run();
|
||||
|
||||
rustdoc()
|
||||
|
Loading…
Reference in New Issue
Block a user