Skip to content

Usage of tokio::select! triggers redundant_pub_crate (nursery) #12213

Closed
@barafael

Description

@barafael

Summary

On nursery lint level, any usage of tokio::select! wrongly triggers the redundant_pub_crate lint.

Lint Name

redundant_pub_crate

Reproducer

I tried this code:

use std::future::Future;
use tokio::select;

pub async fn selects(number: impl Future<Output = i32>, boolean: impl Future<Output = bool>) {
    select! {
        n = number => {
            println!("A number: {n}");
        },
        b = boolean => {
            println!("A boolean: {b}");
        }
    }
}

I saw this happen:

  --> src\lib.rs:5:5
   |
5  | /     select! {
6  | |         n = number => {
7  | |             println!("A number: {n}");
8  | |         },
...  |
11 | |         }
12 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
   = note: `-W clippy::redundant-pub-crate` implied by `-W clippy::nursery`
   = help: to override `-W clippy::nursery` add `#[allow(clippy::redundant_pub_crate)]`
   = note: this warning originates in the macro `$crate::select_priv_declare_output_enum` which comes from the expansion of the macro `select` (in Nightly builds, run with -Z macro-backtrace for more info)

I expected to see this happen: no lint triggered on select!.

Version

rustc 1.77.0-nightly (5d3d3479d 2024-01-23)
binary: rustc
commit-hash: 5d3d3479d774754856db2db3e439dfb88ef3c52f
commit-date: 2024-01-23
host: x86_64-pc-windows-msvc
release: 1.77.0-nightly
LLVM version: 17.0.6

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