From 214a601b378c138e7590cdbfb18a55dd2ea2c8ef Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:26:09 +0200 Subject: [PATCH] Don't evaluate 1-argument `ensure!` condition twice --- eyre/src/macros.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eyre/src/macros.rs b/eyre/src/macros.rs index 032f82a..054a619 100644 --- a/eyre/src/macros.rs +++ b/eyre/src/macros.rs @@ -108,9 +108,7 @@ macro_rules! bail { #[macro_export] macro_rules! ensure { ($cond:expr $(,)?) => { - if !$cond { - $crate::ensure!($cond, concat!("Condition failed: `", stringify!($cond), "`")) - } + $crate::ensure!($cond, concat!("Condition failed: `", stringify!($cond), "`")) }; ($cond:expr, $msg:literal $(,)?) => { if !$cond {