From: Ian Jackson Date: Sun, 14 Mar 2021 19:50:33 +0000 (+0000) Subject: utils: Improve matches_doesnot X-Git-Tag: otter-0.4.0~60 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c99773f4d87bddd4cbd1867b321f238bf9bffe7c;p=otter.git utils: Improve matches_doesnot Signed-off-by: Ian Jackson --- 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),