chiark / gitweb /
utils: matches_doesnot syntax update
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 7 Mar 2021 22:24:22 +0000 (22:24 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 7 Mar 2021 22:24:22 +0000 (22:24 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/utils.rs

index 6169c1629a92a7998f69a4a339df26c80f0b5e84..165b9a27b15d85ddbce95c97c250787c9aedd70f 100644 (file)
@@ -355,12 +355,19 @@ impl<T,U,E,F> IteratorExt<U,E,F> 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]