From 96c1d40ff1e770de7a0360b2971b9e8ddab351b4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 7 Mar 2021 22:24:22 +0000 Subject: [PATCH] utils: matches_doesnot syntax update Signed-off-by: Ian Jackson --- src/utils.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index 6169c162..165b9a27 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -355,12 +355,19 @@ impl IteratorExt for T where #[macro_export] macro_rules! matches_doesnot { - ($v:expr; $y:pat, ! $n:pat) => { match $v { $y => true, $n => false } } + ($v:expr, = $y:pat, ! $n:pat $(,)?) => + { match $v { $y => true, $n => false } } } #[test] fn matches_doesnot_test() { - assert!( matches_doesnot!( Some(42); Some(_), ! None) ); + assert!( + matches_doesnot!( + Some(42), + = Some(_), + ! None + ) + ); } #[macro_export] -- 2.30.2