From bcab18c5fb9a62fd30d8b4a2a57eb9668c92328a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 13 Aug 2024 21:34:41 -0700 Subject: [PATCH] process: Clean up P: AsRef<> into impl AsRef<> where applicable --- src/process.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/process.rs b/src/process.rs index 35ef174..9a7fe86 100644 --- a/src/process.rs +++ b/src/process.rs @@ -13,8 +13,8 @@ use std::process::Stdio; use tokio::process::Command; #[cfg(not(test))] -pub async fn script_exit_code>( - executable: P, +pub async fn script_exit_code( + executable: impl AsRef, args: &[impl AsRef], ) -> Result { // Run given script and return the exit code @@ -28,17 +28,14 @@ pub async fn script_exit_code>( } #[cfg(test)] -pub async fn script_exit_code>( - executable: P, - args: &[impl AsRef], -) -> Result { +pub async fn script_exit_code(executable: AsRef, args: &[impl AsRef]) -> Result { let test = crate::testing::current(); let args: Vec<&OsStr> = args.iter().map(|arg| arg.as_ref()).collect(); let cb = test.process_cb.get(); cb(executable.as_ref(), args.as_ref()).map(|(res, _)| res) } -pub async fn run_script>(executable: P, args: &[impl AsRef]) -> Result<()> { +pub async fn run_script(executable: impl AsRef, args: &[impl AsRef]) -> Result<()> { // Run given script to get exit code and return true on success. // Return Err on failure, but also print an error if needed match script_exit_code(executable, args).await { @@ -49,8 +46,8 @@ pub async fn run_script>(executable: P, args: &[impl AsRef>( - executable: P, +pub async fn script_output( + executable: impl AsRef, args: &[impl AsRef], ) -> Result { // Run given command and return the output given @@ -63,8 +60,8 @@ pub async fn script_output>( } #[cfg(test)] -pub async fn script_output>( - executable: P, +pub async fn script_output( + executable: impl AsRef, args: &[impl AsRef], ) -> Result { let test = crate::testing::current();