From d947cb042bbd3d5a58e8963fef75b98fd83d846e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 9 Jan 2026 09:56:21 -0600 Subject: [PATCH] fix: Add must_use before assertions are applied Fixes #266 --- src/assert.rs | 3 +++ src/cmd.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/src/assert.rs b/src/assert.rs index c767d84..52b40a0 100644 --- a/src/assert.rs +++ b/src/assert.rs @@ -47,6 +47,7 @@ pub trait OutputAssertExt { /// ``` /// /// [`Output`]: std::process::Output + #[must_use] fn assert(self) -> Assert; } @@ -95,6 +96,7 @@ impl Assert { /// Create an `Assert` for a given [`Output`]. /// /// [`Output`]: std::process::Output + #[must_use] pub fn new(output: process::Output) -> Self { Self { output, @@ -124,6 +126,7 @@ impl Assert { /// .append_context("main", "no args") /// .success(); /// ``` + #[must_use] pub fn append_context(mut self, name: &'static str, context: D) -> Self where D: fmt::Display + Send + Sync + 'static, diff --git a/src/cmd.rs b/src/cmd.rs index 3329543..1d50a79 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -186,6 +186,7 @@ impl Command { /// ``` /// /// [`Output`]: std::process::Output + #[must_use] pub fn assert(&mut self) -> Assert { OutputAssertExt::assert(self) }