Skip to content
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

macros: suppress clippy::needless_return and add docs #6874

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

oxalica
Copy link
Contributor

@oxalica oxalica commented Sep 27, 2024

Motivation

Fixes #6869: nightly clippy warns on any #[tokio::{main,test}].

Solution

#[allow(clippy::needless_return)] to suppress that clippy warning. Ideally clippy should allow it for macro generated code, but we have no idea how long it would take to do that.

Also document the reason why we are using a return instead of a tail expression.

Tested to work for 1.83.0-nightly (2bd1e894e 2024-09-26)

It triggers the warning for nightly clippy (since about 2024-09-26), but
is actually intentional.
@Darksonn Darksonn added the A-tokio-macros Area: The tokio-macros crate label Sep 28, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn merged commit 2c14f88 into tokio-rs:master Sep 28, 2024
86 checks passed
@oxalica oxalica deleted the fix/warn-needless-return branch September 28, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-macros Area: The tokio-macros crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clippy warns "unneeded return statement" for #[tokio::{main,test}] fns on latest nightly
2 participants