diff --git a/CHANGELOG.md b/CHANGELOG.md index 048b60e..8fcf928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Unreleased + +- Update `criterion` to v0.6. +- Update to `rust-version` 1.66. + # Version 2.4.0 - Make it so the `Exit` filter can be created without passing ownership of the diff --git a/Cargo.toml b/Cargo.toml index 277c53a..219b2aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ name = "async-io" version = "2.4.0" authors = ["Stjepan Glavina "] edition = "2021" -rust-version = "1.63" +rust-version = "1.66" description = "Async I/O and timers" license = "Apache-2.0 OR MIT" repository = "https://github.com/smol-rs/async-io" @@ -44,7 +44,7 @@ windows-sys = { version = "0.59.0", features = ["Win32_Foundation"] } async-channel = "2.0.0" async-net = "2.0.0" blocking = "1" -criterion = { version = "0.4", default-features = false, features = ["cargo_bench_support"] } +criterion = { version = "0.6", default-features = false, features = ["cargo_bench_support"] } getrandom = "0.3" signal-hook = "0.3" tempfile = "3" diff --git a/benches/io.rs b/benches/io.rs index a0a1a65..4e3b480 100644 --- a/benches/io.rs +++ b/benches/io.rs @@ -1,8 +1,9 @@ //! Benchmarks for a variety of I/O operations. use async_io::Async; -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{criterion_group, criterion_main, Criterion}; use futures_lite::{future, prelude::*}; +use std::hint::black_box; use std::net::{Ipv4Addr, SocketAddr, TcpListener, TcpStream, UdpSocket}; /// Block on a future, either using the I/O driver or simple parking. @@ -32,7 +33,7 @@ fn read_and_write(b: &mut Criterion) { (listener, reader, writer) }; - group.bench_function(format!("TcpStream.{}", driver_name), move |b| { + group.bench_function(format!("TcpStream.{driver_name}"), move |b| { let (_listener, mut reader, mut writer) = init_reader_writer(); let mut buf = vec![0x42; TCP_AMOUNT]; @@ -55,7 +56,7 @@ fn read_and_write(b: &mut Criterion) { use std::os::unix::net::UnixStream; const UNIX_AMOUNT: usize = 1024; - group.bench_function(format!("UnixStream.{}", driver_name), |b| { + group.bench_function(format!("UnixStream.{driver_name}"), |b| { let (mut reader, mut writer) = Async::::pair().unwrap(); let mut buf = vec![0x42; UNIX_AMOUNT]; @@ -79,7 +80,7 @@ fn connect_and_accept(c: &mut Criterion) { for (driver_name, exec) in [("Undriven", false), ("Driven", true)] { // Benchmark the TCP streams. - group.bench_function(format!("TcpStream.{}", driver_name), move |b| { + group.bench_function(format!("TcpStream.{driver_name}"), move |b| { let socket_addr = SocketAddr::new("127.0.0.1".parse::().unwrap().into(), 12345); let listener = Async::::bind(socket_addr).unwrap(); @@ -105,10 +106,10 @@ fn connect_and_accept(c: &mut Criterion) { getrandom::fill(&mut id).unwrap(); let id = u64::from_ne_bytes(id); - let socket_addr = format!("/tmp/async-io-bench-{}.sock", id); + let socket_addr = format!("/tmp/async-io-bench-{id}.sock"); let listener = Async::::bind(&socket_addr).unwrap(); - group.bench_function(format!("UnixStream.{}", driver_name), |b| { + group.bench_function(format!("UnixStream.{driver_name}"), |b| { b.iter(|| { block_on( async { @@ -142,7 +143,7 @@ fn udp_send_recv(c: &mut Criterion) { let mut buf = vec![0x42; UDP_AMOUNT]; for (driver_name, exec) in [("Undriven", false), ("Driven", true)] { - group.bench_function(format!("UdpSocket.{}", driver_name), |b| { + group.bench_function(format!("UdpSocket.{driver_name}"), |b| { b.iter(|| { let buf = &mut buf; diff --git a/benches/timer.rs b/benches/timer.rs index 54af9ff..99b472c 100644 --- a/benches/timer.rs +++ b/benches/timer.rs @@ -1,7 +1,9 @@ //! Benchmarks for registering timers. +use std::hint::black_box; + use async_io::Timer; -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{criterion_group, criterion_main, Criterion}; use futures_lite::future; use std::time::Duration; @@ -24,7 +26,7 @@ fn register_timer(c: &mut Criterion) { // Benchmark registering a timer. group.bench_function( - format!("register_timer.({} previous timers)", prev_timer_count), + format!("register_timer.({prev_timer_count} previous timers)"), |b| { b.iter(|| { let timer = make_timer(); diff --git a/examples/linux-inotify.rs b/examples/linux-inotify.rs index 121b482..e2d89b2 100644 --- a/examples/linux-inotify.rs +++ b/examples/linux-inotify.rs @@ -52,7 +52,7 @@ fn main() -> std::io::Result<()> { // Wait for events in a loop and print them on the screen. loop { for event in unsafe { inotify.read_with_mut(read_op).await? } { - println!("{:?}", event); + println!("{event:?}"); } } })