New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
semicolon-if-nothing-returned false positive with tokio macro #7438
Comments
I tried it on the playground, but couldn't reproduce that warning. Can you provide reproduction on the playground? |
Sorry, I cannot reproduce this on playground, either. However, it's reproduced on a simple cargo project -
output:
|
Thanks, I can reproduce it!
|
Reproduction on the playground. |
I face with same issue when update
|
Since clippy 0.1.54 macros tokio::test and tokio::main trigger clippy::semicolon_if_nothing_returned on func with () return type. Adding semicolon to end generated func wrappers fix it. Fixes: rust-lang/rust-clippy#7438
Beginning from version 0.1.54 (or earlier) `clippy::semicolon_if_nothing_returned` braked by macroses `tokio::test` and `tokio::main` on functions without result type. Adding semicolon into function wrappers fix it. Fixes: rust-lang/rust-clippy#7438
Beginning from version 0.1.54 (or earlier) `clippy::semicolon_if_nothing_returned` braked by macroses `tokio::test` and `tokio::main` on functions without result type. Adding semicolon into function wrappers fix it. Fixes: rust-lang/rust-clippy#7438
Beginning from version 0.1.54 (or earlier) `clippy::semicolon_if_nothing_returned` braked by macroses `tokio::test` and `tokio::main` on functions without result type. Adding semicolon into function wrappers fix it. Fixes: rust-lang/rust-clippy#7438
The problem occurs because the macros I will try to fix this problem on the |
The macros `tokio::main` and `tokio::test` return invalid error messages if the function being wrapped has no return value. This was because the semicolon from the last statement was missing. Also, since version 0.1.54 (or earlier), `clippy::semicolon_if_nothing_returned` triggered false-negative when using the macros `tokio::test` and `tokio::main` on functions without a result type. We can copy the semicolon and the `return` keyword from the last statement from the body of the wrapped function. Fixes: rust-lang/rust-clippy#7438
The macros `tokio::main` and `tokio::test` return invalid error messages if the function being wrapped has no return value. This was because the semicolon from the last statement was missing. Also, since version 0.1.54 (or earlier), `clippy::semicolon_if_nothing_returned` triggered false-negative when using the macros `tokio::test` and `tokio::main` on functions without a result type. We can copy the semicolon and the `return` keyword from the last statement from the body of the wrapped function. Fixes: rust-lang/rust-clippy#7438
The macros `tokio::main` and `tokio::test` return invalid error messages if the function being wrapped has no return value. This was because the semicolon from the last statement was missing. Also, since version 0.1.54 (or earlier), `clippy::semicolon_if_nothing_returned` triggered false-negative when using the macros `tokio::test` and `tokio::main` on functions without a result type. We can copy the semicolon and the `return` keyword from the last statement from the body of the wrapped function. Fixes: rust-lang/rust-clippy#7438
I'm closing this because reproduction seemed to fixed. If anyone have a problem related to this, new issue can be opened. |
Lint name: semicolon-if-nothing-returned
I tried this code:
Instead, this happened:
Meta
cargo clippy -V
: clippy 0.1.55 (952fdf2a 2021-07-05)rustc -Vv
:The text was updated successfully, but these errors were encountered: