Skip to content

unused_unit false positive on macro input #7055

Closed
@trinity-1686a

Description

@trinity-1686a

Lint name: clippy::unused_unit

I tried this code:

use futures::{future::ok, select}

pub async fn func() {
    let mut a = ok::<i32, i32>(1)
    select! { 
        _ = a => (),
    }
}

I expected to see this happen: no linting about the unit being unneeded

Instead, this happened: lint says unit expression is unneeded, but macro won't accept removing it

This looks related to #4076, except select! depends on a proc macro internally

Meta

  • cargo clippy -V: clippy 0.1.52 (07e0e2e 2021-03-24)
  • rustc -Vv:
rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

(reproducible on latest stable too)

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.I-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