From: Ian Jackson Date: Sun, 7 Mar 2021 22:24:22 +0000 (+0000) Subject: utils: matches_doesnot syntax update X-Git-Tag: otter-0.4.0~232 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=96c1d40ff1e770de7a0360b2971b9e8ddab351b4;p=otter.git utils: matches_doesnot syntax update Signed-off-by: Ian Jackson --- 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]