From 8a2bb6112a1dc652841d55ba45f1403b926c8300 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 6 Jul 2025 17:23:48 +0900 Subject: [PATCH 1/2] Fix clippy::uninlined_format_args warning ``` warning: variables can be used directly in the `format!` string --> examples/priority.rs:75:13 | 75 | println!("{:?}", priority); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `#[warn(clippy::uninlined_format_args)]` on by default help: change this to | 75 - println!("{:?}", priority); 75 + println!("{priority:?}"); | warning: variables can be used directly in the `format!` string --> examples/priority.rs:77:13 | 77 | println!("{:?}", priority); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 77 - println!("{:?}", priority); 77 + println!("{priority:?}"); | warning: variables can be used directly in the `format!` string --> benches/executor.rs:62:34 | 62 | group.bench_function(format!("{}::spawn_one", prefix), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `#[warn(clippy::uninlined_format_args)]` on by default help: change this to | 62 - group.bench_function(format!("{}::spawn_one", prefix), |b| { 62 + group.bench_function(format!("{prefix}::spawn_one"), |b| { | warning: variables can be used directly in the `format!` string --> benches/executor.rs:101:34 | 101 | group.bench_function(format!("{}::spawn_many_local", prefix), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 101 - group.bench_function(format!("{}::spawn_many_local", prefix), |b| { 101 + group.bench_function(format!("{prefix}::spawn_many_local"), |b| { | warning: variables can be used directly in the `format!` string --> benches/executor.rs:139:34 | 139 | group.bench_function(format!("{}::spawn_recursively", prefix), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 139 - group.bench_function(format!("{}::spawn_recursively", prefix), |b| { 139 + group.bench_function(format!("{prefix}::spawn_recursively"), |b| { | warning: variables can be used directly in the `format!` string --> benches/executor.rs:204:34 | 204 | group.bench_function(format!("{}::yield_now", prefix), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 204 - group.bench_function(format!("{}::yield_now", prefix), |b| { 204 + group.bench_function(format!("{prefix}::yield_now"), |b| { | warning: variables can be used directly in the `format!` string --> benches/executor.rs:250:34 | 250 | group.bench_function(format!("{}::channels", prefix), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 250 - group.bench_function(format!("{}::channels", prefix), |b| { 250 + group.bench_function(format!("{prefix}::channels"), |b| { | warning: variables can be used directly in the `format!` string --> benches/executor.rs:328:34 | 328 | group.bench_function(format!("{}::web_server", prefix), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 328 - group.bench_function(format!("{}::web_server", prefix), |b| { 328 + group.bench_function(format!("{prefix}::web_server"), |b| { | ``` --- benches/executor.rs | 12 ++++++------ examples/priority.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/benches/executor.rs b/benches/executor.rs index 74b2955..42fedbd 100644 --- a/benches/executor.rs +++ b/benches/executor.rs @@ -59,7 +59,7 @@ fn running_benches(c: &mut Criterion) { for (group_name, multithread) in [("single_thread", false), ("multi_thread", true)].iter() { let mut group = c.benchmark_group(group_name.to_string()); - group.bench_function(format!("{}::spawn_one", prefix), |b| { + group.bench_function(format!("{prefix}::spawn_one"), |b| { if with_static { run_static( || { @@ -98,7 +98,7 @@ fn running_benches(c: &mut Criterion) { }); } - group.bench_function(format!("{}::spawn_many_local", prefix), |b| { + group.bench_function(format!("{prefix}::spawn_many_local"), |b| { if with_static { run_static( || { @@ -136,7 +136,7 @@ fn running_benches(c: &mut Criterion) { } }); - group.bench_function(format!("{}::spawn_recursively", prefix), |b| { + group.bench_function(format!("{prefix}::spawn_recursively"), |b| { #[allow(clippy::manual_async_fn)] fn go(i: usize) -> impl Future + Send + 'static { async move { @@ -201,7 +201,7 @@ fn running_benches(c: &mut Criterion) { } }); - group.bench_function(format!("{}::yield_now", prefix), |b| { + group.bench_function(format!("{prefix}::yield_now"), |b| { if with_static { run_static( || { @@ -247,7 +247,7 @@ fn running_benches(c: &mut Criterion) { } }); - group.bench_function(format!("{}::channels", prefix), |b| { + group.bench_function(format!("{prefix}::channels"), |b| { if with_static { run_static( || { @@ -325,7 +325,7 @@ fn running_benches(c: &mut Criterion) { } }); - group.bench_function(format!("{}::web_server", prefix), |b| { + group.bench_function(format!("{prefix}::web_server"), |b| { if with_static { run_static( || { diff --git a/examples/priority.rs b/examples/priority.rs index 60d5c9a..b1dc01e 100644 --- a/examples/priority.rs +++ b/examples/priority.rs @@ -72,9 +72,9 @@ fn main() { // Spawn a task with this priority. tasks.push(EX.spawn(priority, async move { - println!("{:?}", priority); + println!("{priority:?}"); future::yield_now().await; - println!("{:?}", priority); + println!("{priority:?}"); })); } From ebc479c42b8e1dbc784fff5e46367688b260601b Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 6 Jul 2025 17:25:23 +0900 Subject: [PATCH 2/2] Ignore clippy::unused_unit lint ``` warning: unneeded unit return type --> src/lib.rs:1159:42 | 1159 | struct AsyncCallOnDrop { | ^^^^^^^ help: remove the `-> ()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit = note: `#[warn(clippy::unused_unit)]` on by default ``` --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index baeda1d..74e02db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,6 +38,7 @@ html_logo_url = "https://raw.githubusercontent.com/smol-rs/smol/master/assets/images/logo_fullsize_transparent.png" )] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +#![allow(clippy::unused_unit)] // false positive fixed in Rust 1.89 use std::fmt; use std::marker::PhantomData;