Skip to content

Incorrect clippy::needless_return on async tests in latest nightly #13458

Closed
@amircodota

Description

@amircodota

Summary

In the latest nightly, on tokio::test functions, the last assert is flagged with clippy::needless_return

Reproducer

I tried this code:

#[tokio::test]
async fn test1() {
    assert_eq!(4, 5);
}

And ran this

cargo +nightly clippy --all-targets --all-features 

I expected to see this happen:

I expected clippy to pass

Instead, this happened:

It write this error

warning: unneeded `return` statement
 --> src/main.rs:7:21
  |
7 |     assert_eq!(4, 5);
  |                     ^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
  = note: `#[warn(clippy::needless_return)]` on by default

Version

rustc 1.83.0-nightly (9e394f551 2024-09-25)
binary: rustc
commit-hash: 9e394f551c050ff03c6fc57f190e0761cf0be6e8
commit-date: 2024-09-25
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions