From c99773f4d87bddd4cbd1867b321f238bf9bffe7c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 14 Mar 2021 19:50:33 +0000 Subject: [PATCH] utils: Improve matches_doesnot Signed-off-by: Ian Jackson --- src/utils.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index de6dc560..a84feab9 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -358,11 +358,11 @@ macro_rules! matches_doesnot { ($v:expr, $( $yn:tt $($p:pat)|* - ),* + ),* $(,)? ) => { match $v { $( - $($p)|* => matches_doesnot_yn2bool!($yn), + $($p)|* => $crate::matches_doesnot_yn2bool!($yn), )* } } @@ -377,6 +377,14 @@ fn matches_doesnot_test() { ! None ) ); + assert!( + matches_doesnot!( + Some(42), + ! None, + ! Some(3), + = Some(_), + ) + ); assert!( matches_doesnot!( Some(1), -- 2.30.2