From 168d5c245f28bcf9fe860f7167736c4d5ac13846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 11 Jun 2024 08:11:04 +0200 Subject: [PATCH] Take `&self` in `CompletedProcess` assert matchers --- src/tools/run-make-support/src/command.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs index b9e56ab632a..cc395e491ee 100644 --- a/src/tools/run-make-support/src/command.rs +++ b/src/tools/run-make-support/src/command.rs @@ -107,38 +107,38 @@ impl CompletedProcess { /// Checks that trimmed `stdout` matches trimmed `content`. #[track_caller] - pub fn assert_stdout_equals>(self, content: S) -> Self { + pub fn assert_stdout_equals>(&self, content: S) -> &Self { assert_eq!(self.stdout_utf8().trim(), content.as_ref().trim()); self } #[track_caller] - pub fn assert_stdout_not_contains>(self, needle: S) -> Self { + pub fn assert_stdout_not_contains>(&self, needle: S) -> &Self { assert_not_contains(&self.stdout_utf8(), needle.as_ref()); self } /// Checks that trimmed `stderr` matches trimmed `content`. #[track_caller] - pub fn assert_stderr_equals>(self, content: S) -> Self { + pub fn assert_stderr_equals>(&self, content: S) -> &Self { assert_eq!(self.stderr_utf8().trim(), content.as_ref().trim()); self } #[track_caller] - pub fn assert_stderr_contains>(self, needle: S) -> Self { + pub fn assert_stderr_contains>(&self, needle: S) -> &Self { assert!(self.stderr_utf8().contains(needle.as_ref())); self } #[track_caller] - pub fn assert_stderr_not_contains>(self, needle: S) -> Self { + pub fn assert_stderr_not_contains>(&self, needle: S) -> &Self { assert_not_contains(&self.stdout_utf8(), needle.as_ref()); self } #[track_caller] - pub fn assert_exit_code(self, code: i32) -> Self { + pub fn assert_exit_code(&self, code: i32) -> &Self { assert!(self.output.status.code() == Some(code)); self }