mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
ci: update clippy version to 1.75 (#6273)
This commit is contained in:
parent
3275cfb638
commit
84c5674c60
@ -1 +0,0 @@
|
||||
msrv = "1.63"
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -16,7 +16,7 @@ env:
|
||||
# Change to specific Rust release to pin
|
||||
rust_stable: stable
|
||||
rust_nightly: nightly-2023-10-21
|
||||
rust_clippy: 1.65.0
|
||||
rust_clippy: '1.75'
|
||||
# When updating this, also update:
|
||||
# - README.md
|
||||
# - tokio/README.md
|
||||
@ -25,7 +25,7 @@ env:
|
||||
# - tokio-util/Cargo.toml
|
||||
# - tokio-test/Cargo.toml
|
||||
# - tokio-stream/Cargo.toml
|
||||
rust_min: 1.63.0
|
||||
rust_min: '1.63'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
@ -149,7 +149,7 @@ When updating this, also update:
|
||||
-->
|
||||
|
||||
```
|
||||
cargo +1.65.0 clippy --all --tests --all-features
|
||||
cargo +1.75 clippy --all --tests --all-features
|
||||
```
|
||||
|
||||
When building documentation normally, the markers that list the features
|
||||
|
@ -30,7 +30,6 @@ impl<R> LinesStream<R> {
|
||||
}
|
||||
|
||||
/// Obtain a pinned reference to the inner `Lines<R>`.
|
||||
#[allow(clippy::wrong_self_convention)] // https://github.com/rust-lang/rust-clippy/issues/4546
|
||||
pub fn as_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Lines<R>> {
|
||||
self.project().inner
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ impl<R> SplitStream<R> {
|
||||
}
|
||||
|
||||
/// Obtain a pinned reference to the inner `Split<R>`.
|
||||
#[allow(clippy::wrong_self_convention)] // https://github.com/rust-lang/rust-clippy/issues/4546
|
||||
pub fn as_pin_mut(self: Pin<&mut Self>) -> Pin<&mut Split<R>> {
|
||||
self.project().inner
|
||||
}
|
||||
|
@ -25,8 +25,6 @@
|
||||
//! assert!(task.poll().is_ready(), "Task was not ready!");
|
||||
//! ```
|
||||
|
||||
#![allow(clippy::mutex_atomic)]
|
||||
|
||||
use std::future::Future;
|
||||
use std::mem;
|
||||
use std::ops;
|
||||
|
@ -178,6 +178,8 @@ where
|
||||
locked_node = node.inner.lock().unwrap();
|
||||
locked_parent
|
||||
}
|
||||
// https://github.com/tokio-rs/tokio/pull/6273#discussion_r1443752911
|
||||
#[allow(clippy::unnecessary_literal_unwrap)]
|
||||
Err(TryLockError::Poisoned(err)) => Err(err).unwrap(),
|
||||
};
|
||||
|
||||
|
@ -270,7 +270,7 @@ mod test {
|
||||
for level in 1..5 {
|
||||
for pos in level..64 {
|
||||
let a = pos * 64_usize.pow(level as u32);
|
||||
assert_eq!(pos as usize, slot_for(a as u64, level));
|
||||
assert_eq!(pos, slot_for(a as u64, level));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![cfg(all(feature = "compat"))]
|
||||
#![cfg(feature = "compat")]
|
||||
#![cfg(not(target_os = "wasi"))] // WASI does not support all fs operations
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
|
@ -29,7 +29,7 @@ async fn simple() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn simple_ref() {
|
||||
let v = vec![1, 2, 3i32];
|
||||
let v = [1, 2, 3i32];
|
||||
|
||||
let (send, mut recv) = channel(3);
|
||||
let mut send = PollSender::new(send);
|
||||
|
@ -31,7 +31,7 @@ fn can_drop_future_and_still_get_output() {
|
||||
let pool = task::LocalPoolHandle::new(1);
|
||||
let (sender, receiver) = std::sync::mpsc::channel();
|
||||
|
||||
let _ = pool.spawn_pinned(move || {
|
||||
pool.spawn_pinned(move || {
|
||||
// Rc is !Send + !Sync
|
||||
let local_data = Rc::new("test");
|
||||
|
||||
@ -209,7 +209,7 @@ async fn spawn_by_idx() {
|
||||
},
|
||||
0,
|
||||
);
|
||||
let _ = pool.spawn_pinned_by_idx(
|
||||
pool.spawn_pinned_by_idx(
|
||||
|| async move {
|
||||
barrier2.wait().await;
|
||||
std::thread::current().id()
|
||||
|
@ -164,7 +164,7 @@ impl<E: AioSource> Aio<E> {
|
||||
/// is scheduled to receive a wakeup when the underlying operation
|
||||
/// completes. Note that on multiple calls to `poll_ready`, only the `Waker` from the
|
||||
/// `Context` passed to the most recent call is scheduled to receive a wakeup.
|
||||
pub fn poll_ready<'a>(&'a self, cx: &mut Context<'_>) -> Poll<io::Result<AioEvent>> {
|
||||
pub fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<AioEvent>> {
|
||||
let ev = ready!(self.registration.poll_read_ready(cx))?;
|
||||
Poll::Ready(Ok(AioEvent(ev)))
|
||||
}
|
||||
|
@ -2,8 +2,7 @@
|
||||
clippy::cognitive_complexity,
|
||||
clippy::large_enum_variant,
|
||||
clippy::module_inception,
|
||||
clippy::needless_doctest_main,
|
||||
clippy::declare_interior_mutable_const
|
||||
clippy::needless_doctest_main
|
||||
)]
|
||||
#![warn(
|
||||
missing_debug_implementations,
|
||||
|
@ -351,9 +351,6 @@ impl Context {
|
||||
let mut driver = core.driver.take().expect("driver missing");
|
||||
|
||||
if let Some(f) = &handle.shared.config.before_park {
|
||||
// Incorrect lint, the closures are actually different types so `f`
|
||||
// cannot be passed as an argument to `enter`.
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let (c, ()) = self.enter(core, || f());
|
||||
core = c;
|
||||
}
|
||||
@ -374,9 +371,6 @@ impl Context {
|
||||
}
|
||||
|
||||
if let Some(f) = &handle.shared.config.after_unpark {
|
||||
// Incorrect lint, the closures are actually different types so `f`
|
||||
// cannot be passed as an argument to `enter`.
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let (c, ()) = self.enter(core, || f());
|
||||
core = c;
|
||||
}
|
||||
|
@ -29,15 +29,12 @@ const LIFECYCLE_MASK: usize = 0b11;
|
||||
const NOTIFIED: usize = 0b100;
|
||||
|
||||
/// The join handle is still around.
|
||||
#[allow(clippy::unusual_byte_groupings)] // https://github.com/rust-lang/rust-clippy/issues/6556
|
||||
const JOIN_INTEREST: usize = 0b1_000;
|
||||
|
||||
/// A join handle waker has been set.
|
||||
#[allow(clippy::unusual_byte_groupings)] // https://github.com/rust-lang/rust-clippy/issues/6556
|
||||
const JOIN_WAKER: usize = 0b10_000;
|
||||
|
||||
/// The task has been forcibly cancelled.
|
||||
#[allow(clippy::unusual_byte_groupings)] // https://github.com/rust-lang/rust-clippy/issues/6556
|
||||
const CANCELLED: usize = 0b100_000;
|
||||
|
||||
/// All bits.
|
||||
|
@ -267,7 +267,7 @@ mod test {
|
||||
for level in 1..5 {
|
||||
for pos in level..64 {
|
||||
let a = pos * 64_usize.pow(level as u32);
|
||||
assert_eq!(pos as usize, slot_for(a as u64, level));
|
||||
assert_eq!(pos, slot_for(a as u64, level));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![allow(clippy::unit_arg)]
|
||||
|
||||
use crate::signal::os::{OsExtraData, OsStorage};
|
||||
use crate::sync::watch;
|
||||
use crate::util::once_cell::OnceCell;
|
||||
|
@ -825,7 +825,7 @@ async fn await_error_readiness_invalid_address() {
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
if unsafe { libc::sendmsg(socket_fd, &msg, 0) } == -1 {
|
||||
Err(std::io::Error::last_os_error()).unwrap()
|
||||
panic!("{:?}", std::io::Error::last_os_error())
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![cfg(all(feature = "full"))]
|
||||
#![cfg(feature = "full")]
|
||||
|
||||
use tokio::io::AsyncReadExt;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![cfg(all(feature = "full"))]
|
||||
#![cfg(feature = "full")]
|
||||
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
|
@ -45,8 +45,7 @@ async fn two_await() {
|
||||
let (tx1, rx1) = oneshot::channel::<&str>();
|
||||
let (tx2, rx2) = oneshot::channel::<u32>();
|
||||
|
||||
let mut join =
|
||||
task::spawn(async { tokio::try_join!(async { rx1.await }, async { rx2.await }) });
|
||||
let mut join = task::spawn(async { tokio::try_join!(rx1, rx2) });
|
||||
|
||||
assert_pending!(join.poll());
|
||||
|
||||
@ -67,11 +66,7 @@ async fn err_abort_early() {
|
||||
let (tx2, rx2) = oneshot::channel::<u32>();
|
||||
let (_tx3, rx3) = oneshot::channel::<u32>();
|
||||
|
||||
let mut join = task::spawn(async {
|
||||
tokio::try_join!(async { rx1.await }, async { rx2.await }, async {
|
||||
rx3.await
|
||||
})
|
||||
});
|
||||
let mut join = task::spawn(async { tokio::try_join!(rx1, rx2, rx3) });
|
||||
|
||||
assert_pending!(join.poll());
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![cfg(feature = "full")]
|
||||
#![cfg(all(windows))]
|
||||
#![cfg(windows)]
|
||||
|
||||
use std::io;
|
||||
use std::time::Duration;
|
||||
@ -92,7 +92,7 @@ async fn test_named_pipe_multi_client() -> io::Result<()> {
|
||||
// `io::ErrorKind::NotFound`.
|
||||
server = ServerOptions::new().create(PIPE_NAME)?;
|
||||
|
||||
let _ = tokio::spawn(async move {
|
||||
tokio::spawn(async move {
|
||||
let mut buf = String::new();
|
||||
inner.read_line(&mut buf).await?;
|
||||
inner.write_all(b"pong\n").await?;
|
||||
@ -170,7 +170,7 @@ async fn test_named_pipe_multi_client_ready() -> io::Result<()> {
|
||||
// `io::ErrorKind::NotFound`.
|
||||
server = ServerOptions::new().create(PIPE_NAME)?;
|
||||
|
||||
let _ = tokio::spawn(async move {
|
||||
tokio::spawn(async move {
|
||||
let server = inner_server;
|
||||
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ fn unix_listener_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let sock_path = dir.path().join("socket");
|
||||
let std_listener = std::os::unix::net::UnixListener::bind(&sock_path).unwrap();
|
||||
let std_listener = std::os::unix::net::UnixListener::bind(sock_path).unwrap();
|
||||
|
||||
let panic_location_file = test_panic(|| {
|
||||
let rt = runtime_without_io();
|
||||
@ -150,7 +150,7 @@ fn unix_datagram_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
// Bind the socket to a filesystem path
|
||||
// /let socket_path = tmp.path().join("socket");
|
||||
let std_socket = StdUDS::bind(&sock_path).unwrap();
|
||||
let std_socket = StdUDS::bind(sock_path).unwrap();
|
||||
std_socket.set_nonblocking(true).unwrap();
|
||||
|
||||
let panic_location_file = test_panic(move || {
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![cfg(all(feature = "full"))]
|
||||
#![cfg(feature = "full")]
|
||||
|
||||
use tokio::time::{Duration, Instant};
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![allow(clippy::declare_interior_mutable_const)]
|
||||
#![cfg(all(feature = "full", tokio_unstable))]
|
||||
|
||||
#[cfg(not(target_os = "wasi"))]
|
||||
|
@ -23,7 +23,7 @@ async fn test_with_sleep() {
|
||||
set.detach_all();
|
||||
assert_eq!(set.len(), 0);
|
||||
|
||||
assert!(matches!(set.join_next().await, None));
|
||||
assert!(set.join_next().await.is_none());
|
||||
|
||||
for i in 0..10 {
|
||||
set.spawn(async move {
|
||||
@ -41,7 +41,7 @@ async fn test_with_sleep() {
|
||||
for was_seen in &seen {
|
||||
assert!(was_seen);
|
||||
}
|
||||
assert!(matches!(set.join_next().await, None));
|
||||
assert!(set.join_next().await.is_none());
|
||||
|
||||
// Do it again.
|
||||
for i in 0..10 {
|
||||
@ -59,7 +59,7 @@ async fn test_with_sleep() {
|
||||
for was_seen in &seen {
|
||||
assert!(was_seen);
|
||||
}
|
||||
assert!(matches!(set.join_next().await, None));
|
||||
assert!(set.join_next().await.is_none());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threads
|
||||
#![allow(clippy::declare_interior_mutable_const)]
|
||||
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![allow(clippy::declare_interior_mutable_const)]
|
||||
#![cfg(all(feature = "full", not(target_os = "wasi")))]
|
||||
|
||||
use futures::future;
|
||||
@ -34,7 +33,7 @@ fn local_set_spawn_local_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||
let panic_location_file = test_panic(|| {
|
||||
let _local = task::LocalSet::new();
|
||||
|
||||
let _ = task::spawn_local(async {});
|
||||
task::spawn_local(async {});
|
||||
});
|
||||
|
||||
// The panic location should be in this file
|
||||
|
@ -38,7 +38,7 @@ async fn split() -> Result<()> {
|
||||
Ok(())
|
||||
},
|
||||
async {
|
||||
let mut read_buf = vec![0u8; 32];
|
||||
let mut read_buf = [0u8; 32];
|
||||
let peek_len1 = read_half.peek(&mut read_buf[..]).await?;
|
||||
let peek_len2 = read_half.peek(&mut read_buf[..]).await?;
|
||||
assert_eq!(peek_len1, peek_len2);
|
||||
|
@ -80,7 +80,7 @@ fn timeout_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||
// Runtime without `enable_time` so it has no current timer set.
|
||||
let rt = Builder::new_current_thread().build().unwrap();
|
||||
rt.block_on(async {
|
||||
let _ = timeout(Duration::from_millis(5), future::pending::<()>());
|
||||
let _timeout = timeout(Duration::from_millis(5), future::pending::<()>());
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user