tokio-rs / tokio

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

Improved the code with clippy 1.80 #6569

Closed 41Leahcim closed 4 months ago

41Leahcim commented 4 months ago

I improved the code with clippy 1.80 (nightly 2024-05-16). The code compiles, doesn't cause any warnings with clippy 1.77 and 1.80, and all tests succeed. I know you don't like it when people use a newer version of clippy, let alone the current nightly version, but I wanted to contribute and I don't know enough to contribute more.

Motivation

I'm trying to improve the code of libraries I use and I use Tokio a lot.

Solution

Replaced cmp::max(2, cmp::min(...)) with clamp, removed usize imports, replaced std::usize:: and std::u32:: with usize:: and u32:: respectively, moved parentheses to put the future into the blackbox instead of the unit value.

41Leahcim commented 4 months ago

Do you want me to update it to the latest nightly, beta or stable version?