mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-26 20:40:49 +00:00
Don't evaluate 1-argument ensure!
condition twice (#166)
`ensure!($cond:expr)` currently expands to two nested `if !$cond {}`. Co-authored-by: Jane Losare-Lusby <jlusby@yaah.dev>
This commit is contained in:
parent
586e359220
commit
1369e09fb2
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user