Prohibit multiple predicates (#37)

This commit is contained in:
hyd-dev 2020-10-07 02:42:41 +08:00 committed by GitHub
parent f71bf60f21
commit 7daa598424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,30 +34,30 @@
macro_rules! cfg_if { macro_rules! cfg_if {
// match if/else chains with a final `else` // match if/else chains with a final `else`
($( ($(
if #[cfg($($meta:meta),*)] { $($tokens:tt)* } if #[cfg($meta:meta)] { $($tokens:tt)* }
) else * else { ) else * else {
$($tokens2:tt)* $($tokens2:tt)*
}) => { }) => {
$crate::cfg_if! { $crate::cfg_if! {
@__items @__items
() ; () ;
$( ( ($($meta),*) ($($tokens)*) ), )* $( ( ($meta) ($($tokens)*) ), )*
( () ($($tokens2)*) ), ( () ($($tokens2)*) ),
} }
}; };
// match if/else chains lacking a final `else` // match if/else chains lacking a final `else`
( (
if #[cfg($($i_met:meta),*)] { $($i_tokens:tt)* } if #[cfg($i_met:meta)] { $($i_tokens:tt)* }
$( $(
else if #[cfg($($e_met:meta),*)] { $($e_tokens:tt)* } else if #[cfg($e_met:meta)] { $($e_tokens:tt)* }
)* )*
) => { ) => {
$crate::cfg_if! { $crate::cfg_if! {
@__items @__items
() ; () ;
( ($($i_met),*) ($($i_tokens)*) ), ( ($i_met) ($($i_tokens)*) ),
$( ( ($($e_met),*) ($($e_tokens)*) ), )* $( ( ($e_met) ($($e_tokens)*) ), )*
( () () ), ( () () ),
} }
}; };