tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.95k stars 2.48k forks source link

Clippy errors inside `select!` #5616

Open Erigara opened 1 year ago

Erigara commented 1 year ago

Version

tokio v1.27.0

Platform

Rust playground.

Description

Clippy return errors that originate inside select!.

I tried this code (playground):

#![deny(clippy::arithmetic_side_effects, clippy::redundant_pub_crate)]

extern crate tokio; // 1.27.0

#[tokio::main]
async fn main() {
    let (_, mut receiver) = tokio::sync::mpsc::channel(1);

    loop {
        tokio::select! {
            Some(()) = receiver.recv() => {}
            else => break,
        }
    }
}

I expected to see this happen: clippy run without errors.

Instead, this happened: clippy return errors due to error in the macro select!.

taiki-e commented 1 year ago

This is a clippy bug that warns external macros. (similar to https://github.com/rust-lang/rust-clippy/issues/7304, https://github.com/rust-lang/rust-clippy/issues/10259, https://github.com/rust-lang/rust-clippy/issues/10318, etc.)

I would accept a PR to add the corresponding #[allow()] attribute to the generated code, but please consider submitting issues to https://github.com/rust-lang/rust-clippy to fix the underlying problems.

taiki-e commented 1 year ago

(upstream issue: https://github.com/rust-lang/rust-clippy/issues/10636)