mirror of
https://gitee.com/openharmony/third_party_rust_cfg-if
synced 2024-11-22 22:51:23 +00:00
Prohibit multiple predicates (#37)
This commit is contained in:
parent
f71bf60f21
commit
7daa598424
12
src/lib.rs
12
src/lib.rs
@ -34,30 +34,30 @@
|
||||
macro_rules! cfg_if {
|
||||
// match if/else chains with a final `else`
|
||||
($(
|
||||
if #[cfg($($meta:meta),*)] { $($tokens:tt)* }
|
||||
if #[cfg($meta:meta)] { $($tokens:tt)* }
|
||||
) else * else {
|
||||
$($tokens2:tt)*
|
||||
}) => {
|
||||
$crate::cfg_if! {
|
||||
@__items
|
||||
() ;
|
||||
$( ( ($($meta),*) ($($tokens)*) ), )*
|
||||
$( ( ($meta) ($($tokens)*) ), )*
|
||||
( () ($($tokens2)*) ),
|
||||
}
|
||||
};
|
||||
|
||||
// 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! {
|
||||
@__items
|
||||
() ;
|
||||
( ($($i_met),*) ($($i_tokens)*) ),
|
||||
$( ( ($($e_met),*) ($($e_tokens)*) ), )*
|
||||
( ($i_met) ($($i_tokens)*) ),
|
||||
$( ( ($e_met) ($($e_tokens)*) ), )*
|
||||
( () () ),
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user