
The edition gate is a bit stricter than the drop behaviour, which is fine. The cases we want to avoid are the opposite: not gated but 2021 drop behaviour.
26 lines
566 B
Rust
26 lines
566 B
Rust
//@ edition: 2021
|
|
|
|
#[macro_export]
|
|
macro_rules! make_if {
|
|
(($($tt:tt)*) { $body:expr } { $else:expr }) => {{
|
|
if $($tt)* {
|
|
$body
|
|
} else {
|
|
$else
|
|
}
|
|
}};
|
|
(let ($expr:expr) { $body:expr } { $else:expr }) => {{
|
|
if let None = $expr {
|
|
$body
|
|
} else {
|
|
$else
|
|
}
|
|
}};
|
|
(let ($expr:expr) let ($expr2:expr) { $body:expr } { $else:expr }) => {{
|
|
if let None = $expr && let None = $expr2 {
|
|
$body
|
|
} else {
|
|
$else
|
|
}
|
|
}};
|
|
}
|