From 5f96d7635820c7ac789dd8f80220b3189eac65e3 Mon Sep 17 00:00:00 2001 From: Nick Spinale Date: Mon, 28 Oct 2024 23:21:17 -0700 Subject: [PATCH] Address clippy lints Signed-off-by: Nick Spinale --- .../private/tests/microkit/reset/src/bin/test.rs | 1 + crates/private/tests/root-task/c/src/main.rs | 4 ++-- crates/sel4-async/time/src/timer_queue.rs | 2 +- crates/sel4-atomic-ptr/src/lib.rs | 4 ++-- crates/sel4-atomic-ptr/src/ops.rs | 4 ++-- crates/sel4-backtrace/types/src/with_alloc.rs | 2 +- .../add-spec/src/render_elf.rs | 2 +- .../types/src/cap_table.rs | 12 ++++++------ .../types/src/footprint.rs | 14 +++++++------- .../types/src/frame_init.rs | 16 ++++++++-------- .../sel4-capdl-initializer/types/src/indirect.rs | 3 ++- crates/sel4-capdl-initializer/types/src/spec.rs | 2 +- .../types/src/when_sel4.rs | 2 +- .../sel4-kernel-loader/payload-types/src/lib.rs | 2 +- crates/sel4-logging/src/lib.rs | 2 +- crates/sel4-mod-in-out-dir/src/lib.rs | 4 ++-- crates/sel4-panicking/env/src/lib.rs | 3 +-- crates/sel4-panicking/src/lib.rs | 2 +- crates/sel4-reset/src/lib.rs | 2 +- .../sel4-shared-ring-buffer/block-io/src/lib.rs | 8 ++++---- .../bookkeeping/src/slot_set_semaphore.rs | 6 +++--- crates/sel4-shared-ring-buffer/src/lib.rs | 8 ++++---- crates/sel4/config/build.rs | 2 +- crates/sel4/config/generic/src/attr_macros.rs | 2 +- crates/sel4/config/generic/src/cfg_if.rs | 2 +- crates/sel4/config/generic/src/condition.rs | 2 +- crates/sel4/config/generic/src/expr_macros.rs | 2 +- crates/sel4/src/bootinfo.rs | 2 +- crates/sel4/src/state/token.rs | 4 ++-- crates/sel4/sys/build/main.rs | 2 +- 30 files changed, 62 insertions(+), 61 deletions(-) diff --git a/crates/private/tests/microkit/reset/src/bin/test.rs b/crates/private/tests/microkit/reset/src/bin/test.rs index 18a6baded..99811e540 100644 --- a/crates/private/tests/microkit/reset/src/bin/test.rs +++ b/crates/private/tests/microkit/reset/src/bin/test.rs @@ -6,6 +6,7 @@ #![no_std] #![no_main] +#![allow(static_mut_refs)] use sel4_microkit::{debug_println, protection_domain, NullHandler}; use sel4_reset::reset; diff --git a/crates/private/tests/root-task/c/src/main.rs b/crates/private/tests/root-task/c/src/main.rs index 6c8d5e7c3..dab6de125 100644 --- a/crates/private/tests/root-task/c/src/main.rs +++ b/crates/private/tests/root-task/c/src/main.rs @@ -7,7 +7,7 @@ #![no_std] #![no_main] -use core::ffi::{c_char, CStr}; +use core::ffi::c_char; use sel4_newlib as _; use sel4_root_task::{debug_println, root_task}; @@ -18,7 +18,7 @@ extern "C" { #[root_task] fn main(_: &sel4::BootInfoPtr) -> ! { - let s = CStr::from_bytes_with_nul(b"1234\0").unwrap(); + let s = c"1234"; let n = unsafe { test(s.as_ptr()) }; debug_println!("n = {}", n); assert_eq!(n, 1234 + 234); diff --git a/crates/sel4-async/time/src/timer_queue.rs b/crates/sel4-async/time/src/timer_queue.rs index 41fb9d98b..d510daafc 100644 --- a/crates/sel4-async/time/src/timer_queue.rs +++ b/crates/sel4-async/time/src/timer_queue.rs @@ -134,7 +134,7 @@ pub struct IterExpired<'a, T, U, V> { queue: &'a mut TimerQueue, } -impl<'a, T: Ord + Clone, U: Ord, V> Iterator for IterExpired<'a, T, U, V> { +impl Iterator for IterExpired<'_, T, U, V> { type Item = Expired; fn next(&mut self) -> Option { diff --git a/crates/sel4-atomic-ptr/src/lib.rs b/crates/sel4-atomic-ptr/src/lib.rs index 9a30b5e6a..f5acd0d83 100644 --- a/crates/sel4-atomic-ptr/src/lib.rs +++ b/crates/sel4-atomic-ptr/src/lib.rs @@ -26,7 +26,7 @@ pub struct AtomicPtr<'a, T> { reference: PhantomData<&'a T>, } -impl<'a, T> Copy for AtomicPtr<'a, T> {} +impl Copy for AtomicPtr<'_, T> {} impl Clone for AtomicPtr<'_, T> { fn clone(&self) -> Self { @@ -40,7 +40,7 @@ impl fmt::Debug for AtomicPtr<'_, T> { } } -impl<'a, T> AtomicPtr<'a, T> { +impl AtomicPtr<'_, T> { /// # Safety /// /// Necessary but not sufficient: diff --git a/crates/sel4-atomic-ptr/src/ops.rs b/crates/sel4-atomic-ptr/src/ops.rs index d04e067b9..3daa6bac6 100644 --- a/crates/sel4-atomic-ptr/src/ops.rs +++ b/crates/sel4-atomic-ptr/src/ops.rs @@ -8,7 +8,7 @@ use core::sync::atomic::Ordering; use super::{generic, Atomic, AtomicPtr}; -impl<'a, T> AtomicPtr<'a, T> { +impl AtomicPtr<'_, T> { fn as_mut_ptr(self) -> *mut T { self.pointer.as_ptr() } @@ -18,7 +18,7 @@ impl<'a, T> AtomicPtr<'a, T> { } } -impl<'a, T: Atomic> AtomicPtr<'a, T> { +impl AtomicPtr<'_, T> { #[inline] pub fn load(self, order: Ordering) -> T { // SAFETY: data races are prevented by atomic intrinsics. diff --git a/crates/sel4-backtrace/types/src/with_alloc.rs b/crates/sel4-backtrace/types/src/with_alloc.rs index f5c193054..f3bc28733 100644 --- a/crates/sel4-backtrace/types/src/with_alloc.rs +++ b/crates/sel4-backtrace/types/src/with_alloc.rs @@ -126,7 +126,7 @@ impl Backtrace { pub struct DisplayHex<'a, T>(&'a Backtrace); #[cfg(feature = "postcard")] -impl<'a, T: Serialize> fmt::Display for DisplayHex<'a, T> { +impl fmt::Display for DisplayHex<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for b in self.0.send_to_vec().map_err(|_| fmt::Error)? { write!(f, "{:02x}", b)?; diff --git a/crates/sel4-capdl-initializer/add-spec/src/render_elf.rs b/crates/sel4-capdl-initializer/add-spec/src/render_elf.rs index 2bf0b8482..dd95a4b71 100644 --- a/crates/sel4-capdl-initializer/add-spec/src/render_elf.rs +++ b/crates/sel4-capdl-initializer/add-spec/src/render_elf.rs @@ -15,7 +15,7 @@ pub(crate) struct RenderElfArgs<'a> { pub(crate) heap_size: usize, } -impl<'a> RenderElfArgs<'a> { +impl RenderElfArgs<'_> { pub(crate) fn call_with>( &self, orig_elf: &object::read::elf::ElfFile, diff --git a/crates/sel4-capdl-initializer/types/src/cap_table.rs b/crates/sel4-capdl-initializer/types/src/cap_table.rs index 5928e0b51..71eca232c 100644 --- a/crates/sel4-capdl-initializer/types/src/cap_table.rs +++ b/crates/sel4-capdl-initializer/types/src/cap_table.rs @@ -50,7 +50,7 @@ pub trait HasCapTable { } } -impl<'a> object::Tcb<'a> { +impl object::Tcb<'_> { pub const SLOT_CSPACE: CapSlot = 0; pub const SLOT_VSPACE: CapSlot = 1; pub const SLOT_IPC_BUFFER: CapSlot = 4; @@ -93,7 +93,7 @@ impl<'a> object::Tcb<'a> { } } -impl<'a> object::Irq<'a> { +impl object::Irq<'_> { pub const SLOT_NOTIFICATION: CapSlot = 0; pub fn notification(&self) -> Option<&cap::Notification> { @@ -101,7 +101,7 @@ impl<'a> object::Irq<'a> { } } -impl<'a> object::ArmIrq<'a> { +impl object::ArmIrq<'_> { pub const SLOT_NOTIFICATION: CapSlot = 0; pub fn notification(&self) -> Option<&cap::Notification> { @@ -109,7 +109,7 @@ impl<'a> object::ArmIrq<'a> { } } -impl<'a> object::IrqMsi<'a> { +impl object::IrqMsi<'_> { pub const SLOT_NOTIFICATION: CapSlot = 0; pub fn notification(&self) -> Option<&cap::Notification> { @@ -117,7 +117,7 @@ impl<'a> object::IrqMsi<'a> { } } -impl<'a> object::IrqIOApic<'a> { +impl object::IrqIOApic<'_> { pub const SLOT_NOTIFICATION: CapSlot = 0; pub fn notification(&self) -> Option<&cap::Notification> { @@ -127,7 +127,7 @@ impl<'a> object::IrqIOApic<'a> { // // // -impl<'a> object::PageTable<'a> { +impl object::PageTable<'_> { pub fn entries(&self) -> impl Iterator { self.slots_as() } diff --git a/crates/sel4-capdl-initializer/types/src/footprint.rs b/crates/sel4-capdl-initializer/types/src/footprint.rs index 63dd77223..0c94d156a 100644 --- a/crates/sel4-capdl-initializer/types/src/footprint.rs +++ b/crates/sel4-capdl-initializer/types/src/footprint.rs @@ -36,7 +36,7 @@ impl Footprint for IndirectEmbeddedFrame {} #[cfg(feature = "deflate")] impl Footprint for IndirectDeflatedBytesContent {} -impl<'a, T: Sized + Footprint> Footprint for Indirect<'a, T> { +impl Footprint for Indirect<'_, T> { fn external_footprint(&self) -> usize { self.inner().total_footprint() } @@ -51,13 +51,13 @@ impl Footprint for Option { } } -impl<'a, T: Footprint> Footprint for Indirect<'a, [T]> { +impl Footprint for Indirect<'_, [T]> { fn external_footprint(&self) -> usize { self.inner().iter().map(Footprint::total_footprint).sum() } } -impl<'a, N: Footprint, D: Footprint, M: Footprint> Footprint for Spec<'a, N, D, M> { +impl Footprint for Spec<'_, N, D, M> { fn external_footprint(&self) -> usize { self.objects.external_footprint() + self.irqs.external_footprint() @@ -65,13 +65,13 @@ impl<'a, N: Footprint, D: Footprint, M: Footprint> Footprint for Spec<'a, N, D, } } -impl<'a, N: Footprint, D: Footprint, M: Footprint> Footprint for NamedObject<'a, N, D, M> { +impl Footprint for NamedObject<'_, N, D, M> { fn external_footprint(&self) -> usize { self.name.external_footprint() + self.object.external_footprint() } } -impl<'a, D: Footprint, M: Footprint> Footprint for Object<'a, D, M> { +impl Footprint for Object<'_, D, M> { fn external_footprint(&self) -> usize { match self { Self::CNode(obj) => obj.slots.external_footprint(), @@ -85,7 +85,7 @@ impl<'a, D: Footprint, M: Footprint> Footprint for Object<'a, D, M> { } } -impl<'a, D: Footprint, M: Footprint> Footprint for FrameInit<'a, D, M> { +impl Footprint for FrameInit<'_, D, M> { fn external_footprint(&self) -> usize { match self { Self::Fill(fill) => fill.external_footprint(), @@ -94,7 +94,7 @@ impl<'a, D: Footprint, M: Footprint> Footprint for FrameInit<'a, D, M> { } } -impl<'a, D: Footprint> Footprint for Fill<'a, D> { +impl Footprint for Fill<'_, D> { fn external_footprint(&self) -> usize { self.entries.external_footprint() } diff --git a/crates/sel4-capdl-initializer/types/src/frame_init.rs b/crates/sel4-capdl-initializer/types/src/frame_init.rs index 4c037dfcb..c9fd45835 100644 --- a/crates/sel4-capdl-initializer/types/src/frame_init.rs +++ b/crates/sel4-capdl-initializer/types/src/frame_init.rs @@ -61,7 +61,7 @@ impl<'a, D> FrameInit<'a, D, NeverEmbedded> { } } -impl<'a, D> object::Frame<'a, D, NeverEmbedded> { +impl object::Frame<'_, D, NeverEmbedded> { pub fn can_embed(&self, granule_size_bits: usize, is_root: bool) -> bool { is_root && self.paddr.is_none() @@ -167,7 +167,7 @@ pub struct Fill<'a, D> { pub entries: Indirect<'a, [FillEntry]>, } -impl<'a, D> Fill<'a, D> { +impl Fill<'_, D> { pub fn depends_on_bootinfo(&self) -> bool { self.entries.iter().any(|entry| entry.content.is_bootinfo()) } @@ -278,19 +278,19 @@ pub struct BytesContent<'a> { } #[cfg(feature = "alloc")] -impl<'a> BytesContent<'a> { +impl BytesContent<'_> { pub fn pack(raw_content: &[u8]) -> Vec { raw_content.to_vec() } } -impl<'a> SelfContainedContent for BytesContent<'a> { +impl SelfContainedContent for BytesContent<'_> { fn self_contained_copy_out(&self, dst: &mut [u8]) { dst.copy_from_slice(self.bytes) } } -impl<'a> fmt::Debug for BytesContent<'a> { +impl fmt::Debug for BytesContent<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("BytesContent") .field("bytes", &"&[...]") @@ -306,14 +306,14 @@ pub struct DeflatedBytesContent<'a> { } #[cfg(all(feature = "alloc", feature = "deflate"))] -impl<'a> DeflatedBytesContent<'a> { +impl DeflatedBytesContent<'_> { pub fn pack(raw_content: &[u8]) -> Vec { miniz_oxide::deflate::compress_to_vec(raw_content, 10) } } #[cfg(feature = "deflate")] -impl<'a> SelfContainedContent for DeflatedBytesContent<'a> { +impl SelfContainedContent for DeflatedBytesContent<'_> { fn self_contained_copy_out(&self, dst: &mut [u8]) { let n = miniz_oxide::inflate::decompress_slice_iter_to_slice( dst, @@ -327,7 +327,7 @@ impl<'a> SelfContainedContent for DeflatedBytesContent<'a> { } #[cfg(feature = "deflate")] -impl<'a> fmt::Debug for DeflatedBytesContent<'a> { +impl fmt::Debug for DeflatedBytesContent<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("DeflatedBytesContent") .field("deflated_bytes", &"&[...]") diff --git a/crates/sel4-capdl-initializer/types/src/indirect.rs b/crates/sel4-capdl-initializer/types/src/indirect.rs index 704e2295f..79cb2ff79 100644 --- a/crates/sel4-capdl-initializer/types/src/indirect.rs +++ b/crates/sel4-capdl-initializer/types/src/indirect.rs @@ -40,6 +40,7 @@ enum IndirectImpl<'a, T: ?Sized> { }, } +#[allow(clippy::needless_lifetimes)] impl<'a, T: ?Sized> Indirect<'a, T> { #[cfg(feature = "borrowed-indirect")] pub const fn from_borrowed(borrowed: &'a T) -> Self { @@ -121,7 +122,7 @@ impl fmt::Debug for Indirect<'_, T> { } } -impl<'a, 'b, T: ?Sized, U: ?Sized> PartialEq> for Indirect<'a, T> +impl<'b, T: ?Sized, U: ?Sized> PartialEq> for Indirect<'_, T> where T: PartialEq, { diff --git a/crates/sel4-capdl-initializer/types/src/spec.rs b/crates/sel4-capdl-initializer/types/src/spec.rs index 6bfba1654..bc526ab69 100644 --- a/crates/sel4-capdl-initializer/types/src/spec.rs +++ b/crates/sel4-capdl-initializer/types/src/spec.rs @@ -86,7 +86,7 @@ pub enum Object<'a, D, M> { Reply, } -impl<'a, D, M> Object<'a, D, M> { +impl Object<'_, D, M> { pub fn paddr(&self) -> Option { match self { Object::Untyped(obj) => obj.paddr, diff --git a/crates/sel4-capdl-initializer/types/src/when_sel4.rs b/crates/sel4-capdl-initializer/types/src/when_sel4.rs index 09bc80608..4a810cc2a 100644 --- a/crates/sel4-capdl-initializer/types/src/when_sel4.rs +++ b/crates/sel4-capdl-initializer/types/src/when_sel4.rs @@ -8,7 +8,7 @@ use sel4::{ObjectBlueprint, VmAttributes}; use crate::{cap, Badge, Cap, FillEntryContentBootInfoId, Object, Rights}; -impl<'a, D, M> Object<'a, D, M> { +impl Object<'_, D, M> { pub fn blueprint(&self) -> Option { Some(sel4::sel4_cfg_wrap_match! { match self { diff --git a/crates/sel4-kernel-loader/payload-types/src/lib.rs b/crates/sel4-kernel-loader/payload-types/src/lib.rs index fef26f3f8..29f06698f 100644 --- a/crates/sel4-kernel-loader/payload-types/src/lib.rs +++ b/crates/sel4-kernel-loader/payload-types/src/lib.rs @@ -110,7 +110,7 @@ pub struct DirectRegionContent<'a> { pub content: &'a [u8], } -impl<'a> RegionContent for DirectRegionContent<'a> { +impl RegionContent for DirectRegionContent<'_> { type Source = (); fn len(&self) -> usize { diff --git a/crates/sel4-logging/src/lib.rs b/crates/sel4-logging/src/lib.rs index 52ab09e68..b706161d3 100644 --- a/crates/sel4-logging/src/lib.rs +++ b/crates/sel4-logging/src/lib.rs @@ -91,7 +91,7 @@ struct DisplayWrapper<'a> { record: &'a Record<'a>, } -impl<'a> fmt::Display for DisplayWrapper<'a> { +impl fmt::Display for DisplayWrapper<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (self.fmt)(self.record, f) } diff --git a/crates/sel4-mod-in-out-dir/src/lib.rs b/crates/sel4-mod-in-out-dir/src/lib.rs index 1ce4e8ec5..b9e416c6e 100644 --- a/crates/sel4-mod-in-out-dir/src/lib.rs +++ b/crates/sel4-mod-in-out-dir/src/lib.rs @@ -19,13 +19,13 @@ use syn::{parse_macro_input, ItemMod, MetaNameValue, Result}; /// #[path = concat!(env!("OUT_DIR"), "/foo.rs")] /// mod foo; /// ``` - +/// /// This macro does exactly that: /// ```ignore /// #[in_out_dir] /// mod foo; /// ``` - +/// /// This works too: /// ```ignore /// #[in_out_dir(relative_path = "path/to/bar.rs")] diff --git a/crates/sel4-panicking/env/src/lib.rs b/crates/sel4-panicking/env/src/lib.rs index 9c9c81dee..d8b8f3626 100644 --- a/crates/sel4-panicking/env/src/lib.rs +++ b/crates/sel4-panicking/env/src/lib.rs @@ -135,7 +135,7 @@ pub struct AbortInfo<'a> { location: Option<&'a Location<'a>>, } -impl<'a> AbortInfo<'a> { +impl AbortInfo<'_> { /// The `core::fmt::Arguments` with which [`abort!`] was called. pub fn message(&self) -> Option<&fmt::Arguments> { self.message @@ -211,7 +211,6 @@ pub fn __abort_macro_helper(message: Option) -> ! { /// the [`AbortInfo`] argument using [`debug_print!`]. /// /// [`register_abort_hook`] provides a typesafe way to define that symbol. - #[macro_export] macro_rules! abort { () => ($crate::__abort_macro_helper(::core::option::Option::None)); diff --git a/crates/sel4-panicking/src/lib.rs b/crates/sel4-panicking/src/lib.rs index e87624cbe..41b01af37 100644 --- a/crates/sel4-panicking/src/lib.rs +++ b/crates/sel4-panicking/src/lib.rs @@ -54,7 +54,7 @@ pub struct ExternalPanicInfo<'a> { can_unwind: bool, } -impl<'a> ExternalPanicInfo<'a> { +impl ExternalPanicInfo<'_> { pub fn payload(&self) -> &Payload { &self.payload } diff --git a/crates/sel4-reset/src/lib.rs b/crates/sel4-reset/src/lib.rs index 6ec2ee0f0..3cc2895eb 100644 --- a/crates/sel4-reset/src/lib.rs +++ b/crates/sel4-reset/src/lib.rs @@ -30,7 +30,7 @@ struct Regions<'a> { data: &'a [u8], } -impl<'a> Regions<'a> { +impl Regions<'_> { unsafe fn reset_memory(&self) { for meta in self.meta { let dst = unsafe { slice::from_raw_parts_mut(meta.vaddr as *mut _, meta.memsz) }; diff --git a/crates/sel4-shared-ring-buffer/block-io/src/lib.rs b/crates/sel4-shared-ring-buffer/block-io/src/lib.rs index b035a59bb..efe350910 100644 --- a/crates/sel4-shared-ring-buffer/block-io/src/lib.rs +++ b/crates/sel4-shared-ring-buffer/block-io/src/lib.rs @@ -172,8 +172,8 @@ impl<'a, N, P: Access, A: AbstractBounceBufferAllocator, F: FnMut()> RequestFutu } } -impl<'a, N, P: Access, A: AbstractBounceBufferAllocator, F: FnMut()> Future - for RequestFuture<'a, N, P, A, F> +impl Future + for RequestFuture<'_, N, P, A, F> { type Output = Result<(), Error>; @@ -182,8 +182,8 @@ impl<'a, N, P: Access, A: AbstractBounceBufferAllocator, F: FnMut()> Future } } -impl<'a, N, P: Access, A: AbstractBounceBufferAllocator, F: FnMut()> Drop - for RequestFuture<'a, N, P, A, F> +impl Drop + for RequestFuture<'_, N, P, A, F> { fn drop(&mut self) { if !self.poll_returned_ready { diff --git a/crates/sel4-shared-ring-buffer/bookkeeping/src/slot_set_semaphore.rs b/crates/sel4-shared-ring-buffer/bookkeeping/src/slot_set_semaphore.rs index 233955f86..039054e32 100644 --- a/crates/sel4-shared-ring-buffer/bookkeeping/src/slot_set_semaphore.rs +++ b/crates/sel4-shared-ring-buffer/bookkeeping/src/slot_set_semaphore.rs @@ -144,13 +144,13 @@ impl<'a, T: SlotSemaphore> TemporaryPermit<'a, T> { } } -impl<'a, T: SlotSemaphore> Drop for TemporaryPermit<'a, T> { +impl Drop for TemporaryPermit<'_, T> { fn drop(&mut self) { self.sem.give(self.n); } } -impl<'a, T: SlotSemaphore, const N: usize> SlotSetReservation<'a, T, N> { +impl SlotSetReservation<'_, T, N> { pub fn count(&self) -> usize { self.n } @@ -176,7 +176,7 @@ impl<'a, T: SlotSemaphore, const N: usize> SlotSetReservation<'a, T, N> { } } -impl<'a, T: SlotSemaphore, const N: usize> Drop for SlotSetReservation<'a, T, N> { +impl Drop for SlotSetReservation<'_, T, N> { fn drop(&mut self) { for sem in &self.handle.per_pool_semaphores { sem.give(self.n); diff --git a/crates/sel4-shared-ring-buffer/src/lib.rs b/crates/sel4-shared-ring-buffer/src/lib.rs index 08e088032..7da62dd12 100644 --- a/crates/sel4-shared-ring-buffer/src/lib.rs +++ b/crates/sel4-shared-ring-buffer/src/lib.rs @@ -85,13 +85,13 @@ impl<'a, R: RingBuffersRole, F, T: Copy> RingBuffers<'a, R, F, T> { } } -impl<'a, U, R: RingBuffersRole, F: Fn() -> U, T> RingBuffers<'a, R, F, T> { +impl U, T> RingBuffers<'_, R, F, T> { pub fn notify(&self) -> U { (self.notify)() } } -impl<'a, U, R: RingBuffersRole, F: FnMut() -> U, T> RingBuffers<'a, R, F, T> { +impl U, T> RingBuffers<'_, R, F, T> { pub fn notify_mut(&mut self) -> U { (self.notify)() } @@ -219,7 +219,7 @@ impl<'a, R: RingBufferRole, T: Copy> RingBuffer<'a, R, T> { } } -impl<'a, T: Copy + FromBytes + IntoBytes> RingBuffer<'a, Write, T> { +impl RingBuffer<'_, Write, T> { pub fn enqueue_and_commit(&mut self, desc: T) -> Result, PeerMisbehaviorError> { self.enqueue(desc, true) } @@ -263,7 +263,7 @@ impl<'a, T: Copy + FromBytes + IntoBytes> RingBuffer<'a, Write, T> { } } -impl<'a, T: Copy + FromBytes + IntoBytes> RingBuffer<'a, Read, T> { +impl RingBuffer<'_, Read, T> { pub fn dequeue(&mut self) -> Result, PeerMisbehaviorError> { if self.is_empty()? { return Ok(None); diff --git a/crates/sel4/config/build.rs b/crates/sel4/config/build.rs index 1d31e9669..eef3102b3 100644 --- a/crates/sel4/config/build.rs +++ b/crates/sel4/config/build.rs @@ -16,5 +16,5 @@ fn main() { let formatted = prettyplease::unparse(&syn::parse2(toks).unwrap()); let out_dir = env::var("OUT_DIR").unwrap(); let out_path = PathBuf::from(&out_dir).join("consts_gen.rs"); - fs::write(&out_path, formatted).unwrap(); + fs::write(out_path, formatted).unwrap(); } diff --git a/crates/sel4/config/generic/src/attr_macros.rs b/crates/sel4/config/generic/src/attr_macros.rs index 888ee2f4a..c0d61d1b8 100644 --- a/crates/sel4/config/generic/src/attr_macros.rs +++ b/crates/sel4/config/generic/src/attr_macros.rs @@ -20,7 +20,7 @@ macro_rules! ensure_empty { }; } -impl<'a> MacroImpls<'a> { +impl MacroImpls<'_> { pub fn cfg_impl(&self, input: TokenStream, item: TokenStream) -> TokenStream { let cond = parse_or_return!(input as Condition); let r = self.eval(&cond); diff --git a/crates/sel4/config/generic/src/cfg_if.rs b/crates/sel4/config/generic/src/cfg_if.rs index 6d9f65a4e..4ff0e0892 100644 --- a/crates/sel4/config/generic/src/cfg_if.rs +++ b/crates/sel4/config/generic/src/cfg_if.rs @@ -14,7 +14,7 @@ use syn::{ use crate::{Condition, MacroImpls}; -impl<'a> MacroImpls<'a> { +impl MacroImpls<'_> { pub fn cfg_if_impl(&self, toks: TokenStream) -> TokenStream { let parser = move |parse_stream: ParseStream| { parse_cfg_if_input(self.synthetic_attr(), parse_stream) diff --git a/crates/sel4/config/generic/src/condition.rs b/crates/sel4/config/generic/src/condition.rs index fc4a75e4a..f9e472d18 100644 --- a/crates/sel4/config/generic/src/condition.rs +++ b/crates/sel4/config/generic/src/condition.rs @@ -92,7 +92,7 @@ fn err(node: impl Spanned, message: U) -> Result { struct ConfigurationForEval<'a>(&'a Configuration); -impl<'a> ConfigurationForEval<'a> { +impl ConfigurationForEval<'_> { fn lookup_key(&self, k: &syn::Ident) -> Result<&Value, EvalError> { self.0 .get(&k.to_string()) diff --git a/crates/sel4/config/generic/src/expr_macros.rs b/crates/sel4/config/generic/src/expr_macros.rs index 1e8be0ee0..12f6432d7 100644 --- a/crates/sel4/config/generic/src/expr_macros.rs +++ b/crates/sel4/config/generic/src/expr_macros.rs @@ -17,7 +17,7 @@ use sel4_config_generic_types::{Key, Value}; use crate::{parse_or_return, MacroImpls}; -impl<'a> MacroImpls<'a> { +impl MacroImpls<'_> { pub fn cfg_generic_impl( &self, key_toks: TokenStream, diff --git a/crates/sel4/src/bootinfo.rs b/crates/sel4/src/bootinfo.rs index aaf851ee7..8f31bba5c 100644 --- a/crates/sel4/src/bootinfo.rs +++ b/crates/sel4/src/bootinfo.rs @@ -152,7 +152,7 @@ pub struct BootInfoExtra<'a> { pub content_with_header: &'a [u8], } -impl<'a> BootInfoExtra<'a> { +impl BootInfoExtra<'_> { pub fn content_with_header(&self) -> &[u8] { self.content_with_header } diff --git a/crates/sel4/src/state/token.rs b/crates/sel4/src/state/token.rs index 9aba67cbd..c6598c617 100644 --- a/crates/sel4/src/state/token.rs +++ b/crates/sel4/src/state/token.rs @@ -149,7 +149,7 @@ type BorrowFlag = AtomicIsize; pub(crate) struct SyncTokenBorrow<'a>(&'a BorrowFlag); -impl<'a> Drop for SyncTokenBorrow<'a> { +impl Drop for SyncTokenBorrow<'_> { fn drop(&mut self) { self.0.fetch_sub(1, Ordering::Release); } @@ -157,7 +157,7 @@ impl<'a> Drop for SyncTokenBorrow<'a> { pub(crate) struct SyncTokenBorrowMut<'a>(&'a BorrowFlag); -impl<'a> Drop for SyncTokenBorrowMut<'a> { +impl Drop for SyncTokenBorrowMut<'_> { fn drop(&mut self) { self.0.fetch_add(1, Ordering::Release); } diff --git a/crates/sel4/sys/build/main.rs b/crates/sel4/sys/build/main.rs index b6fa2e087..3b96f3471 100644 --- a/crates/sel4/sys/build/main.rs +++ b/crates/sel4/sys/build/main.rs @@ -85,6 +85,6 @@ impl OutDir { fn write_file(&self, toks: TokenStream, filename: impl AsRef) { let formatted = prettyplease::unparse(&syn::parse2(toks).unwrap()); let out_path = self.path.join(filename); - fs::write(&out_path, formatted).unwrap(); + fs::write(out_path, formatted).unwrap(); } }