From d63bcdf4f08ec933649531dc7352ad1461c3d30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ja=C5=ADhien=20Piatlicki?= Date: Mon, 9 Dec 2024 15:01:21 +0100 Subject: [PATCH] Fix clippy warnings after version update --- nexosim/src/channel/queue.rs | 8 ++++---- nexosim/src/executor/task.rs | 2 +- nexosim/src/model/context.rs | 1 - nexosim/src/ports/output/broadcaster.rs | 4 ++-- nexosim/src/ports/output/sender.rs | 4 ++-- nexosim/src/util/task_set.rs | 5 ++--- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/nexosim/src/channel/queue.rs b/nexosim/src/channel/queue.rs index 7876c3e..57747de 100644 --- a/nexosim/src/channel/queue.rs +++ b/nexosim/src/channel/queue.rs @@ -33,7 +33,7 @@ pub(super) struct MessageBorrow<'a, T: ?Sized> { stamp: usize, } -impl<'a, T: ?Sized> Deref for MessageBorrow<'a, T> { +impl Deref for MessageBorrow<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -41,13 +41,13 @@ impl<'a, T: ?Sized> Deref for MessageBorrow<'a, T> { } } -impl<'a, T: ?Sized> DerefMut for MessageBorrow<'a, T> { +impl DerefMut for MessageBorrow<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.msg } } -impl<'a, T: ?Sized> Drop for MessageBorrow<'a, T> { +impl Drop for MessageBorrow<'_, T> { fn drop(&mut self) { let slot = &self.queue.buffer[self.index]; @@ -67,7 +67,7 @@ impl<'a, T: ?Sized> Drop for MessageBorrow<'a, T> { slot.stamp.store(self.stamp, Ordering::Release); } } -impl<'a, M> fmt::Debug for MessageBorrow<'a, M> { +impl fmt::Debug for MessageBorrow<'_, M> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("MessageBorrow").finish_non_exhaustive() } diff --git a/nexosim/src/executor/task.rs b/nexosim/src/executor/task.rs index 3b3bd5f..cbec651 100644 --- a/nexosim/src/executor/task.rs +++ b/nexosim/src/executor/task.rs @@ -315,7 +315,7 @@ where /// /// An arbitrary tag can be attached to the task, a clone of which will be /// passed to the scheduling function each time it is called. - +/// /// The returned `Runnable` must be scheduled by the user. pub(crate) fn spawn( future: F, diff --git a/nexosim/src/model/context.rs b/nexosim/src/model/context.rs index e71b7a4..2d593e6 100644 --- a/nexosim/src/model/context.rs +++ b/nexosim/src/model/context.rs @@ -70,7 +70,6 @@ use super::{Model, ProtoModel}; /// } /// impl Model for DelayedGreeter {} /// ``` - // The self-scheduling caveat seems related to this issue: // https://github.com/rust-lang/rust/issues/78649 pub struct Context { diff --git a/nexosim/src/ports/output/broadcaster.rs b/nexosim/src/ports/output/broadcaster.rs index ee09f54..e7d7470 100644 --- a/nexosim/src/ports/output/broadcaster.rs +++ b/nexosim/src/ports/output/broadcaster.rs @@ -350,7 +350,7 @@ impl<'a, R> BroadcastFuture<'a, R> { } } -impl<'a, R> Drop for BroadcastFuture<'a, R> { +impl Drop for BroadcastFuture<'_, R> { fn drop(&mut self) { // Safety: this is safe since `self.futures` is never accessed after it // is moved out. @@ -361,7 +361,7 @@ impl<'a, R> Drop for BroadcastFuture<'a, R> { } } -impl<'a, R> Future for BroadcastFuture<'a, R> { +impl Future for BroadcastFuture<'_, R> { type Output = Result<(), SendError>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/nexosim/src/ports/output/sender.rs b/nexosim/src/ports/output/sender.rs index ce85587..933cbf3 100644 --- a/nexosim/src/ports/output/sender.rs +++ b/nexosim/src/ports/output/sender.rs @@ -736,7 +736,7 @@ impl<'a, T> RecycledFuture<'a, T> { } } -impl<'a, T> Drop for RecycledFuture<'a, T> { +impl Drop for RecycledFuture<'_, T> { fn drop(&mut self) { // Return the box to the lender. // @@ -747,7 +747,7 @@ impl<'a, T> Drop for RecycledFuture<'a, T> { } } -impl<'a, T> Future for RecycledFuture<'a, T> { +impl Future for RecycledFuture<'_, T> { type Output = T; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/nexosim/src/util/task_set.rs b/nexosim/src/util/task_set.rs index 3ad9b4f..c8f0da4 100644 --- a/nexosim/src/util/task_set.rs +++ b/nexosim/src/util/task_set.rs @@ -42,7 +42,6 @@ const COUNTDOWN_ONE: u64 = 1 << 32; /// more than 1 to wake the parent task less frequently. For instance, if /// `notify_count` is set to the number of pending sub-tasks, the parent task /// will only be woken once all subtasks have been woken. - pub(crate) struct TaskSet { /// Set of all tasks, scheduled or not. /// @@ -355,7 +354,7 @@ pub(crate) struct TaskIterator<'a> { next_index: u32, } -impl<'a> Iterator for TaskIterator<'a> { +impl Iterator for TaskIterator<'_> { type Item = usize; fn next(&mut self) -> Option { @@ -380,7 +379,7 @@ impl<'a> Iterator for TaskIterator<'a> { } } -impl<'a> Drop for TaskIterator<'a> { +impl Drop for TaskIterator<'_> { fn drop(&mut self) { // Put all remaining scheduled tasks in the sleeping state. //