From 31d7bf02ce7804ea80b56e04ffde9869dab6a096 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 24 Jan 2023 14:30:22 +0100 Subject: [PATCH] style: make normalize_output() take a &str instead of a String --- tests/common/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index d2838884b..3a5313796 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -84,7 +84,7 @@ impl TestEnvironment { /// Run a `jj` command, check that it was successful, and return its stdout pub fn jj_cmd_success(&self, current_dir: &Path, args: &[&str]) -> String { let assert = self.jj_cmd(current_dir, args).assert().success().stderr(""); - self.normalize_output(get_stdout_string(&assert)) + self.normalize_output(&get_stdout_string(&assert)) } /// Run a `jj` command, check that it failed with code 1, and return its @@ -92,7 +92,7 @@ impl TestEnvironment { #[must_use] pub fn jj_cmd_failure(&self, current_dir: &Path, args: &[&str]) -> String { let assert = self.jj_cmd(current_dir, args).assert().code(1).stdout(""); - self.normalize_output(get_stderr_string(&assert)) + self.normalize_output(&get_stderr_string(&assert)) } /// Run a `jj` command and check that it failed with code 2 (for invalid @@ -100,7 +100,7 @@ impl TestEnvironment { #[must_use] pub fn jj_cmd_cli_error(&self, current_dir: &Path, args: &[&str]) -> String { let assert = self.jj_cmd(current_dir, args).assert().code(2).stdout(""); - self.normalize_output(get_stderr_string(&assert)) + self.normalize_output(&get_stderr_string(&assert)) } pub fn env_root(&self) -> &Path { @@ -182,7 +182,7 @@ impl TestEnvironment { edit_script } - pub fn normalize_output(&self, text: String) -> String { + pub fn normalize_output(&self, text: &str) -> String { let text = text.replace("jj.exe", "jj"); let regex = Regex::new(&format!( r"{}(\S+)",