Skip to content

Commit 45c299c

Browse files
committed
Fix clippy::uninlined_format_args warning
``` error: variables can be used directly in the `format!` string --> examples/linux-inotify.rs:55:17 | 55 | println!("{:?}", event); | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `-D clippy::uninlined-format-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]` help: change this to | 55 - println!("{:?}", event); 55 + println!("{event:?}"); | error: variables can be used directly in the `format!` string --> benches/io.rs:35:30 | 35 | group.bench_function(format!("TcpStream.{}", driver_name), move |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `-D clippy::uninlined-format-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]` help: change this to | 35 - group.bench_function(format!("TcpStream.{}", driver_name), move |b| { 35 + group.bench_function(format!("TcpStream.{driver_name}"), move |b| { | error: variables can be used directly in the `format!` string --> benches/io.rs:58:34 | 58 | group.bench_function(format!("UnixStream.{}", driver_name), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 58 - group.bench_function(format!("UnixStream.{}", driver_name), |b| { 58 + group.bench_function(format!("UnixStream.{driver_name}"), |b| { | error: variables can be used directly in the `format!` string --> benches/io.rs:82:30 | 82 | group.bench_function(format!("TcpStream.{}", driver_name), move |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 82 - group.bench_function(format!("TcpStream.{}", driver_name), move |b| { 82 + group.bench_function(format!("TcpStream.{driver_name}"), move |b| { | error: variables can be used directly in the `format!` string --> benches/io.rs:108:31 | 108 | let socket_addr = format!("/tmp/async-io-bench-{}.sock", id); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 108 - let socket_addr = format!("/tmp/async-io-bench-{}.sock", id); 108 + let socket_addr = format!("/tmp/async-io-bench-{id}.sock"); | error: variables can be used directly in the `format!` string --> benches/io.rs:111:34 | 111 | group.bench_function(format!("UnixStream.{}", driver_name), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 111 - group.bench_function(format!("UnixStream.{}", driver_name), |b| { 111 + group.bench_function(format!("UnixStream.{driver_name}"), |b| { | error: variables can be used directly in the `format!` string --> benches/io.rs:145:30 | 145 | group.bench_function(format!("UdpSocket.{}", driver_name), |b| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 145 - group.bench_function(format!("UdpSocket.{}", driver_name), |b| { 145 + group.bench_function(format!("UdpSocket.{driver_name}"), |b| { | error: variables can be used directly in the `format!` string --> benches/timer.rs:27:13 | 27 | format!("register_timer.({} previous timers)", prev_timer_count), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `-D clippy::uninlined-format-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]` help: change this to | 27 - format!("register_timer.({} previous timers)", prev_timer_count), 27 + format!("register_timer.({prev_timer_count} previous timers)"), | ```
1 parent a355982 commit 45c299c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

benches/io.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn read_and_write(b: &mut Criterion) {
3232
(listener, reader, writer)
3333
};
3434

35-
group.bench_function(format!("TcpStream.{}", driver_name), move |b| {
35+
group.bench_function(format!("TcpStream.{driver_name}"), move |b| {
3636
let (_listener, mut reader, mut writer) = init_reader_writer();
3737
let mut buf = vec![0x42; TCP_AMOUNT];
3838

@@ -55,7 +55,7 @@ fn read_and_write(b: &mut Criterion) {
5555
use std::os::unix::net::UnixStream;
5656
const UNIX_AMOUNT: usize = 1024;
5757

58-
group.bench_function(format!("UnixStream.{}", driver_name), |b| {
58+
group.bench_function(format!("UnixStream.{driver_name}"), |b| {
5959
let (mut reader, mut writer) = Async::<UnixStream>::pair().unwrap();
6060
let mut buf = vec![0x42; UNIX_AMOUNT];
6161

@@ -79,7 +79,7 @@ fn connect_and_accept(c: &mut Criterion) {
7979

8080
for (driver_name, exec) in [("Undriven", false), ("Driven", true)] {
8181
// Benchmark the TCP streams.
82-
group.bench_function(format!("TcpStream.{}", driver_name), move |b| {
82+
group.bench_function(format!("TcpStream.{driver_name}"), move |b| {
8383
let socket_addr =
8484
SocketAddr::new("127.0.0.1".parse::<Ipv4Addr>().unwrap().into(), 12345);
8585
let listener = Async::<TcpListener>::bind(socket_addr).unwrap();
@@ -105,10 +105,10 @@ fn connect_and_accept(c: &mut Criterion) {
105105
getrandom::fill(&mut id).unwrap();
106106
let id = u64::from_ne_bytes(id);
107107

108-
let socket_addr = format!("/tmp/async-io-bench-{}.sock", id);
108+
let socket_addr = format!("/tmp/async-io-bench-{id}.sock");
109109
let listener = Async::<UnixListener>::bind(&socket_addr).unwrap();
110110

111-
group.bench_function(format!("UnixStream.{}", driver_name), |b| {
111+
group.bench_function(format!("UnixStream.{driver_name}"), |b| {
112112
b.iter(|| {
113113
block_on(
114114
async {
@@ -142,7 +142,7 @@ fn udp_send_recv(c: &mut Criterion) {
142142
let mut buf = vec![0x42; UDP_AMOUNT];
143143

144144
for (driver_name, exec) in [("Undriven", false), ("Driven", true)] {
145-
group.bench_function(format!("UdpSocket.{}", driver_name), |b| {
145+
group.bench_function(format!("UdpSocket.{driver_name}"), |b| {
146146
b.iter(|| {
147147
let buf = &mut buf;
148148

benches/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn register_timer(c: &mut Criterion) {
2424

2525
// Benchmark registering a timer.
2626
group.bench_function(
27-
format!("register_timer.({} previous timers)", prev_timer_count),
27+
format!("register_timer.({prev_timer_count} previous timers)"),
2828
|b| {
2929
b.iter(|| {
3030
let timer = make_timer();

examples/linux-inotify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn main() -> std::io::Result<()> {
5252
// Wait for events in a loop and print them on the screen.
5353
loop {
5454
for event in unsafe { inotify.read_with_mut(read_op).await? } {
55-
println!("{:?}", event);
55+
println!("{event:?}");
5656
}
5757
}
5858
})

0 commit comments

Comments
 (0)