diff options
Diffstat (limited to 'vendor/tokio/tests/macros_test.rs')
-rw-r--r-- | vendor/tokio/tests/macros_test.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/tokio/tests/macros_test.rs b/vendor/tokio/tests/macros_test.rs index bca2c9198..85279b7ed 100644 --- a/vendor/tokio/tests/macros_test.rs +++ b/vendor/tokio/tests/macros_test.rs @@ -1,3 +1,5 @@ +#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threading + use tokio::test; #[test] @@ -46,3 +48,41 @@ pub async fn issue_4175_test() -> std::io::Result<()> { return Ok(()); panic!(); } + +// https://github.com/tokio-rs/tokio/issues/4175 +#[allow(clippy::let_unit_value)] +pub mod clippy_semicolon_if_nothing_returned { + #![deny(clippy::semicolon_if_nothing_returned)] + + #[tokio::main] + pub async fn local() { + let _x = (); + } + #[tokio::main] + pub async fn item() { + fn _f() {} + } + #[tokio::main] + pub async fn semi() { + panic!(); + } + #[tokio::main] + pub async fn empty() { + // To trigger clippy::semicolon_if_nothing_returned lint, the block needs to contain newline. + } +} + +// https://github.com/tokio-rs/tokio/issues/5243 +pub mod issue_5243 { + macro_rules! mac { + (async fn $name:ident() $b:block) => { + #[::tokio::test] + async fn $name() { + $b + } + }; + } + mac!( + async fn foo() {} + ); +} |