From 3936ebdfe4f44eda5630a9b461bbbc9976e5542c Mon Sep 17 00:00:00 2001 From: Siech0 Date: Sat, 30 Mar 2024 02:49:42 -0400 Subject: [PATCH] chore: update CI to clippy 1.77 (#6443) --- .github/workflows/ci.yml | 2 +- CONTRIBUTING.md | 2 +- tokio-util/tests/compat.rs | 1 + tokio/src/runtime/signal/mod.rs | 1 + tokio/tests/io_async_fd.rs | 2 +- tokio/tests/rt_common.rs | 4 ++-- tokio/tests/task_local_set.rs | 16 ++++++++-------- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9738caeb..1ff7da915 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ env: # Change to specific Rust release to pin rust_stable: stable rust_nightly: nightly-2023-10-21 - rust_clippy: '1.76' + rust_clippy: '1.77' # When updating this, also update: # - README.md # - tokio/README.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 369a898fd..b6b9f4301 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,7 +149,7 @@ When updating this, also update: --> ``` -cargo +1.76 clippy --all --tests --all-features +cargo +1.77 clippy --all --tests --all-features ``` When building documentation normally, the markers that list the features diff --git a/tokio-util/tests/compat.rs b/tokio-util/tests/compat.rs index 8a0eab340..1c77081f8 100644 --- a/tokio-util/tests/compat.rs +++ b/tokio-util/tests/compat.rs @@ -15,6 +15,7 @@ async fn compat_file_seek() -> futures_util::io::Result<()> { .read(true) .write(true) .create(true) + .truncate(true) .open(temp_file) .await? .compat_write(); diff --git a/tokio/src/runtime/signal/mod.rs b/tokio/src/runtime/signal/mod.rs index 0dea18794..bc50c6e98 100644 --- a/tokio/src/runtime/signal/mod.rs +++ b/tokio/src/runtime/signal/mod.rs @@ -112,6 +112,7 @@ impl Driver { // Drain the pipe completely so we can receive a new readiness event // if another signal has come in. let mut buf = [0; 128]; + #[allow(clippy::unused_io_amount)] loop { match self.receiver.read(&mut buf) { Ok(0) => panic!("EOF on self-pipe"), diff --git a/tokio/tests/io_async_fd.rs b/tokio/tests/io_async_fd.rs index 6f8a10aef..ea798b306 100644 --- a/tokio/tests/io_async_fd.rs +++ b/tokio/tests/io_async_fd.rs @@ -150,7 +150,7 @@ fn socketpair() -> (FileDescriptor, FileDescriptor) { fn drain(mut fd: &FileDescriptor) { let mut buf = [0u8; 512]; - + #[allow(clippy::unused_io_amount)] loop { match fd.read(&mut buf[..]) { Err(e) if e.kind() == ErrorKind::WouldBlock => break, diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs index 11c44a8d1..a71fc4a73 100644 --- a/tokio/tests/rt_common.rs +++ b/tokio/tests/rt_common.rs @@ -1089,7 +1089,7 @@ rt_test! { use std::thread; thread_local!( - static R: RefCell> = RefCell::new(None); + static R: RefCell> = const { RefCell::new(None) }; ); thread::spawn(|| { @@ -1402,7 +1402,7 @@ rt_test! { } std::thread_local! { - static TL_DATA: RefCell> = RefCell::new(None); + static TL_DATA: RefCell> = const { RefCell::new(None) }; }; let (send, recv) = channel(); diff --git a/tokio/tests/task_local_set.rs b/tokio/tests/task_local_set.rs index 168a05808..d965eb341 100644 --- a/tokio/tests/task_local_set.rs +++ b/tokio/tests/task_local_set.rs @@ -34,7 +34,7 @@ async fn local_current_thread_scheduler() { #[tokio::test(flavor = "multi_thread")] async fn local_threadpool() { thread_local! { - static ON_RT_THREAD: Cell = Cell::new(false); + static ON_RT_THREAD: Cell = const { Cell::new(false) }; } ON_RT_THREAD.with(|cell| cell.set(true)); @@ -55,7 +55,7 @@ async fn local_threadpool() { #[tokio::test(flavor = "multi_thread")] async fn localset_future_threadpool() { thread_local! { - static ON_LOCAL_THREAD: Cell = Cell::new(false); + static ON_LOCAL_THREAD: Cell = const { Cell::new(false) }; } ON_LOCAL_THREAD.with(|cell| cell.set(true)); @@ -118,7 +118,7 @@ async fn local_threadpool_timer() { // This test ensures that runtime services like the timer are properly // set for the local task set. thread_local! { - static ON_RT_THREAD: Cell = Cell::new(false); + static ON_RT_THREAD: Cell = const { Cell::new(false) }; } ON_RT_THREAD.with(|cell| cell.set(true)); @@ -158,7 +158,7 @@ fn enter_guard_spawn() { #[should_panic] fn local_threadpool_blocking_in_place() { thread_local! { - static ON_RT_THREAD: Cell = Cell::new(false); + static ON_RT_THREAD: Cell = const { Cell::new(false) }; } ON_RT_THREAD.with(|cell| cell.set(true)); @@ -182,7 +182,7 @@ fn local_threadpool_blocking_in_place() { #[tokio::test(flavor = "multi_thread")] async fn local_threadpool_blocking_run() { thread_local! { - static ON_RT_THREAD: Cell = Cell::new(false); + static ON_RT_THREAD: Cell = const { Cell::new(false) }; } ON_RT_THREAD.with(|cell| cell.set(true)); @@ -212,7 +212,7 @@ async fn local_threadpool_blocking_run() { async fn all_spawns_are_local() { use futures::future; thread_local! { - static ON_RT_THREAD: Cell = Cell::new(false); + static ON_RT_THREAD: Cell = const { Cell::new(false) }; } ON_RT_THREAD.with(|cell| cell.set(true)); @@ -238,7 +238,7 @@ async fn all_spawns_are_local() { #[tokio::test(flavor = "multi_thread")] async fn nested_spawn_is_local() { thread_local! { - static ON_RT_THREAD: Cell = Cell::new(false); + static ON_RT_THREAD: Cell = const { Cell::new(false) }; } ON_RT_THREAD.with(|cell| cell.set(true)); @@ -274,7 +274,7 @@ async fn nested_spawn_is_local() { #[test] fn join_local_future_elsewhere() { thread_local! { - static ON_RT_THREAD: Cell = Cell::new(false); + static ON_RT_THREAD: Cell = const { Cell::new(false) }; } ON_RT_THREAD.with(|cell| cell.set(true));