Skip to content

no_effect_underscore_binding fires on ignored parameters of async fns #12279

Closed
@Arnavion

Description

@Arnavion

Summary

Happens for both regular async fns and async-fn-in-trait. Of course for a regular fn one could just remove the parameter entirely. The trait case is the more important one.

Lint Name

no_effect_underscore_binding

Reproducer

I tried this code:

#![deny(clippy::no_effect_underscore_binding)]

pub trait Foo {
    async fn bar(i: u64);
}

pub struct Bar;

impl Foo for Bar {
    async fn bar(_i: u64) {}
}

pub async fn baz(_i: u64) {}

I saw this happen:

error: binding to `_` prefixed variable with no side-effect
  --> src/lib.rs:10:18
   |
10 |     async fn bar(_i: u64) {}
   |                  ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_effect_underscore_binding
error: binding to `_` prefixed variable with no side-effect
  --> src/lib.rs:13:18
   |
13 | pub async fn baz(_i: u64) {}
   |                  ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_effect_underscore_binding

I expected to see this happen:

Lint does not trigger.

Version

rustc 1.78.0-nightly (d44e3b95c 2024-02-09)
binary: rustc
commit-hash: d44e3b95cb9d410d89cb8ab3233906a33f43756a
commit-date: 2024-02-09
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

Additional Labels

No response

Metadata

Metadata

Assignees

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