Merge branch 'main' into zed2

This commit is contained in:
Conrad Irwin 2023-10-27 10:55:15 +02:00
commit 4a6a17d866
238 changed files with 17140 additions and 6659 deletions

View file

@ -350,19 +350,19 @@ pub fn unzip_option<T, U>(option: Option<(T, U)>) -> (Option<T>, Option<U>) {
}
}
/// Immediately invoked function expression. Good for using the ? operator
/// Evaluates to an immediately invoked function expression. Good for using the ? operator
/// in functions which do not return an Option or Result
#[macro_export]
macro_rules! iife {
macro_rules! maybe {
($block:block) => {
(|| $block)()
};
}
/// Async Immediately invoked function expression. Good for using the ? operator
/// in functions which do not return an Option or Result. Async version of above
/// Evaluates to an immediately invoked function expression. Good for using the ? operator
/// in functions which do not return an Option or Result, but async.
#[macro_export]
macro_rules! async_iife {
macro_rules! async_maybe {
($block:block) => {
(|| async move { $block })()
};
@ -449,7 +449,7 @@ mod tests {
None
}
let foo = iife!({
let foo = maybe!({
option_returning_function()?;
Some(())
});