aboutsummaryrefslogtreecommitdiff
path: root/tests/macros_test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/macros_test.rs')
-rw-r--r--tests/macros_test.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/macros_test.rs b/tests/macros_test.rs
index bca2c91..85279b7 100644
--- a/tests/macros_test.rs
+++ b/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() {}
+ );
+}