From 011995c284f05559772b952270e0a6b796eb4119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E9=80=B8?= Date: Thu, 1 May 2025 17:19:40 +0800 Subject: [PATCH 1/2] fix: reduce warnings --- compio-driver/src/lib.rs | 3 ++- compio-macros/src/item_fn.rs | 2 +- compio-net/tests/poll.rs | 6 +++--- compio-net/tests/tcp_connect.rs | 2 +- compio-quic/benches/quic.rs | 4 ++-- compio-quic/examples/http3-client.rs | 6 +++--- compio-quic/examples/http3-server.rs | 2 +- compio-quic/examples/quic-client.rs | 2 +- compio-quic/examples/quic-dispatcher.rs | 2 +- compio-quic/examples/quic-server.rs | 2 +- compio/examples/basic.rs | 2 +- compio/examples/dispatcher.rs | 2 +- compio/examples/resolve.rs | 2 +- compio/examples/tick.rs | 2 +- 14 files changed, 20 insertions(+), 19 deletions(-) diff --git a/compio-driver/src/lib.rs b/compio-driver/src/lib.rs index af3313f1b..9b7551be5 100644 --- a/compio-driver/src/lib.rs +++ b/compio-driver/src/lib.rs @@ -336,7 +336,8 @@ impl Proactor { /// /// # Safety /// - /// Caller must make sure to release the buffer pool with the correct driver, i.e., the one they created the buffer pool with. + /// Caller must make sure to release the buffer pool with the correct + /// driver, i.e., the one they created the buffer pool with. pub unsafe fn release_buffer_pool(&mut self, buffer_pool: BufferPool) -> io::Result<()> { self.driver.release_buffer_pool(buffer_pool) } diff --git a/compio-macros/src/item_fn.rs b/compio-macros/src/item_fn.rs index 2a610d0c4..b7ecdeec3 100644 --- a/compio-macros/src/item_fn.rs +++ b/compio-macros/src/item_fn.rs @@ -56,7 +56,7 @@ impl RawBodyItemFn { } } } else { - panic!("Unsupported property {}", ident); + panic!("Unsupported property {ident}"); } } } diff --git a/compio-net/tests/poll.rs b/compio-net/tests/poll.rs index 7b181c623..a617f060f 100644 --- a/compio-net/tests/poll.rs +++ b/compio-net/tests/poll.rs @@ -33,7 +33,7 @@ async fn poll_connect() { match listener.accept() { Ok(res) => break res, Err(e) if e.kind() == io::ErrorKind::WouldBlock => continue, - Err(e) => panic!("{:?}", e), + Err(e) => panic!("{e:?}"), } } }; @@ -60,7 +60,7 @@ async fn poll_connect() { match tx.send(b"Hello world!") { Ok(res) => break res, Err(e) if is_would_block(&e) => {} - Err(e) => panic!("{:?}", e), + Err(e) => panic!("{e:?}"), } tx.write_ready().await.unwrap(); } @@ -75,7 +75,7 @@ async fn poll_connect() { break res; } Err(e) if is_would_block(&e) => {} - Err(e) => panic!("{:?}", e), + Err(e) => panic!("{e:?}"), } client.read_ready().await.unwrap(); } diff --git a/compio-net/tests/tcp_connect.rs b/compio-net/tests/tcp_connect.rs index a8ff75805..70cbff6ed 100644 --- a/compio-net/tests/tcp_connect.rs +++ b/compio-net/tests/tcp_connect.rs @@ -52,7 +52,7 @@ async fn test_connect_impl(mapping: impl FnOnce(&TcpListe let client = async { match TcpStream::connect(addr).await { Ok(_) => (), - Err(e) => panic!("Failed to connect: {}", e), + Err(e) => panic!("Failed to connect: {e}"), } }; diff --git a/compio-quic/benches/quic.rs b/compio-quic/benches/quic.rs index be5a1bca0..32ee309b3 100644 --- a/compio-quic/benches/quic.rs +++ b/compio-quic/benches/quic.rs @@ -178,12 +178,12 @@ fn echo(c: &mut Criterion) { group.throughput(Throughput::Bytes((data.len() * streams * 2) as u64)); group.bench_with_input( - BenchmarkId::new("compio-quic", format!("{}-streams-{}-bytes", streams, size)), + BenchmarkId::new("compio-quic", format!("{streams}-streams-{size}-bytes")), &(), |b, _| echo_compio_quic(b, data, streams), ); group.bench_with_input( - BenchmarkId::new("quinn", format!("{}-streams-{}-bytes", streams, size)), + BenchmarkId::new("quinn", format!("{streams}-streams-{size}-bytes")), &(), |b, _| echo_quinn(b, data, streams), ); diff --git a/compio-quic/examples/http3-client.rs b/compio-quic/examples/http3-client.rs index 3d8566a5f..abbc9897f 100644 --- a/compio-quic/examples/http3-client.rs +++ b/compio-quic/examples/http3-client.rs @@ -49,7 +49,7 @@ async fn main() { .unwrap(); { - println!("Connecting to {} at {}", host, remote); + println!("Connecting to {host} at {remote}"); let conn = endpoint.connect(remote, host, None).unwrap().await.unwrap(); let (mut conn, mut send_req) = compio_quic::h3::client::new(conn).await.unwrap(); @@ -60,7 +60,7 @@ async fn main() { stream.finish().await.unwrap(); let resp = stream.recv_response().await.unwrap(); - println!("{:?}", resp); + println!("{resp:?}"); let mut out = compio_fs::File::create(outpath).await.unwrap(); let mut pos = 0; @@ -72,7 +72,7 @@ async fn main() { pos += len as u64; } if let Some(headers) = stream.recv_trailers().await.unwrap() { - println!("{:?}", headers); + println!("{headers:?}"); } drop(send_req); diff --git a/compio-quic/examples/http3-server.rs b/compio-quic/examples/http3-server.rs index 66cf27549..b0fbd6c5f 100644 --- a/compio-quic/examples/http3-server.rs +++ b/compio-quic/examples/http3-server.rs @@ -33,7 +33,7 @@ async fn main() { .unwrap(); while let Ok(Some((req, mut stream))) = conn.accept().await { - println!("Received request: {:?}", req); + println!("Received request: {req:?}"); stream .send_response( Response::builder() diff --git a/compio-quic/examples/quic-client.rs b/compio-quic/examples/quic-client.rs index 85fb23be9..f40b9d01e 100644 --- a/compio-quic/examples/quic-client.rs +++ b/compio-quic/examples/quic-client.rs @@ -32,7 +32,7 @@ async fn main() { let mut buf = vec![]; recv.read_to_end(&mut buf).await.unwrap(); - println!("{:?}", buf); + println!("{buf:?}"); conn.close(1u32.into(), b"bye"); } diff --git a/compio-quic/examples/quic-dispatcher.rs b/compio-quic/examples/quic-dispatcher.rs index 42c0f2a82..79e1dd834 100644 --- a/compio-quic/examples/quic-dispatcher.rs +++ b/compio-quic/examples/quic-dispatcher.rs @@ -40,7 +40,7 @@ async fn main() { .await .unwrap(); let mut send = conn.open_uni().unwrap(); - send.write_all(format!("Hello world {}!", i).as_bytes()) + send.write_all(format!("Hello world {i}!").as_bytes()) .await .unwrap(); send.finish().unwrap(); diff --git a/compio-quic/examples/quic-server.rs b/compio-quic/examples/quic-server.rs index 20b6c01b1..0bfc2cd58 100644 --- a/compio-quic/examples/quic-server.rs +++ b/compio-quic/examples/quic-server.rs @@ -26,7 +26,7 @@ async fn main() { let mut buf = vec![]; recv.read_to_end(&mut buf).await.unwrap(); - println!("{:?}", buf); + println!("{buf:?}"); send.write(&[4, 5, 6]).await.unwrap(); send.finish().unwrap(); diff --git a/compio/examples/basic.rs b/compio/examples/basic.rs index 61be27305..0724ac700 100644 --- a/compio/examples/basic.rs +++ b/compio/examples/basic.rs @@ -13,6 +13,6 @@ async fn main() { .unwrap(); assert_eq!(read, buffer.len()); let buffer = String::from_utf8(buffer).unwrap(); - println!("{}", buffer); + println!("{buffer}"); file.close().await.unwrap(); } diff --git a/compio/examples/dispatcher.rs b/compio/examples/dispatcher.rs index f06380171..e447d8a16 100644 --- a/compio/examples/dispatcher.rs +++ b/compio/examples/dispatcher.rs @@ -25,7 +25,7 @@ async fn main() { let addr = &addr; async move { let mut cli = TcpStream::connect(addr).await.unwrap(); - cli.write_all(format!("Hello world {}!", i)).await.unwrap(); + cli.write_all(format!("Hello world {i}!")).await.unwrap(); } })); while let Some(()) = futures.next().await {} diff --git a/compio/examples/resolve.rs b/compio/examples/resolve.rs index 3ee048f06..5bbe886d8 100644 --- a/compio/examples/resolve.rs +++ b/compio/examples/resolve.rs @@ -13,7 +13,7 @@ async fn main() { }) .collect::>(); while let Some((addrs, name)) = tasks.next().await { - println!("Address of {}", name); + println!("Address of {name}"); for addr in addrs { println!(" {}", addr.ip()); } diff --git a/compio/examples/tick.rs b/compio/examples/tick.rs index 877627592..944e120a9 100644 --- a/compio/examples/tick.rs +++ b/compio/examples/tick.rs @@ -7,7 +7,7 @@ use futures_util::{FutureExt, select}; async fn main() { let mut interval = interval(Duration::from_secs(2)); loop { - let mut ctrlc = ctrl_c(); + let ctrlc = ctrl_c(); let ctrlc = std::pin::pin!(ctrlc); select! { res = ctrlc.fuse() => { From ce083b57b4382101f4f9b7c34ce388075822506d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E9=80=B8?= Date: Thu, 1 May 2025 17:29:37 +0800 Subject: [PATCH 2/2] fix(ci): remove ubuntu-20.04 --- .github/workflows/ci_test.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index a589befcf..9769597f8 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -22,8 +22,8 @@ jobs: matrix: toolchain: ["nightly", "beta", "stable"] setup: - - os: "ubuntu-20.04" - - os: "ubuntu-20.04" + - os: "ubuntu-22.04" + - os: "ubuntu-22.04" features: "polling" # fusion - os: "ubuntu-22.04" features: "io-uring-sqe128,io-uring-cqe32,io-uring-socket" @@ -31,15 +31,9 @@ jobs: features: "io-uring-buf-ring" - os: "ubuntu-22.04" features: "polling,io-uring-buf-ring" # fusion & buf-ring - - os: "ubuntu-20.04" - features: "polling,ring" - no_default_features: true - os: "ubuntu-22.04" features: "polling,ring" no_default_features: true - - os: "ubuntu-20.04" - features: "polling,native-tls,ring" - no_default_features: true - os: "ubuntu-22.04" features: "polling,native-tls,ring" no_default_features: true