chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c78dc6a
)
utils: Improve matches_doesnot
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 14 Mar 2021 19:50:33 +0000
(19:50 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 14 Mar 2021 19:50:53 +0000
(19:50 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/utils.rs
patch
|
blob
|
history
diff --git
a/src/utils.rs
b/src/utils.rs
index de6dc560758e1256853c714a2a3addd010ace43c..a84feab9f15021b9d0845356341eeb6aa4eb3b75 100644
(file)
--- 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),