diff --git a/crates/rune-alloc/src/btree/map.rs b/crates/rune-alloc/src/btree/map.rs index e9775c28d..7c42d27d9 100644 --- a/crates/rune-alloc/src/btree/map.rs +++ b/crates/rune-alloc/src/btree/map.rs @@ -1978,7 +1978,7 @@ impl ExactSizeIterator for IterMut<'_, K, V> { impl FusedIterator for IterMut<'_, K, V> {} -impl<'a, K, V> IterMut<'a, K, V> { +impl IterMut<'_, K, V> { /// Returns an iterator of references over the remaining items. #[inline] pub(super) fn iter(&self) -> Iter<'_, K, V> { @@ -2017,7 +2017,7 @@ impl Drop for IntoIter { fn drop(&mut self) { struct DropGuard<'a, K, V, A: Allocator>(&'a mut IntoIter); - impl<'a, K, V, A: Allocator> Drop for DropGuard<'a, K, V, A> { + impl Drop for DropGuard<'_, K, V, A> { fn drop(&mut self) { // Continue the same loop we perform below. This only runs when unwinding, so we // don't have to care about panics this time (they'll abort). @@ -2272,7 +2272,7 @@ where } } -impl<'a, K, V> ExtractIfInner<'a, K, V> { +impl ExtractIfInner<'_, K, V> { /// Allow Debug implementations to predict the next element. pub(super) fn peek(&self) -> Option<(&K, &V)> { let edge = self.cur_leaf_edge.as_ref()?; @@ -3270,7 +3270,7 @@ impl<'a, K, V> Cursor<'a, K, V> { } } -impl<'a, K, V, A> CursorMut<'a, K, V, A> { +impl CursorMut<'_, K, V, A> { /// Moves the cursor to the next element of the `BTreeMap`. /// /// If the cursor is pointing to the "ghost" non-element then this will move it to @@ -3409,7 +3409,7 @@ impl<'a, K, V, A> CursorMut<'a, K, V, A> { } // Now the tree editing operations -impl<'a, K: Ord, V, A: Allocator> CursorMut<'a, K, V, A> { +impl CursorMut<'_, K, V, A> { /// Inserts a new element into the `BTreeMap` after the current one. /// /// If the cursor is pointing at the "ghost" non-element then the new element is diff --git a/crates/rune-alloc/src/btree/map/entry.rs b/crates/rune-alloc/src/btree/map/entry.rs index dd5275ac2..4bd6dfb24 100644 --- a/crates/rune-alloc/src/btree/map/entry.rs +++ b/crates/rune-alloc/src/btree/map/entry.rs @@ -99,7 +99,7 @@ impl Debug for OccupiedError<'_, K, V, A } } -impl<'a, K: Debug + Ord, V: Debug, A: Allocator> fmt::Display for OccupiedError<'a, K, V, A> { +impl fmt::Display for OccupiedError<'_, K, V, A> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, diff --git a/crates/rune-alloc/src/btree/node.rs b/crates/rune-alloc/src/btree/node.rs index c4e35d577..676a91b57 100644 --- a/crates/rune-alloc/src/btree/node.rs +++ b/crates/rune-alloc/src/btree/node.rs @@ -288,7 +288,7 @@ impl NodeRef { } } -impl<'a, K, V> NodeRef, K, V, marker::Internal> { +impl NodeRef, K, V, marker::Internal> { /// Borrows exclusive access to the data of an internal node. fn as_internal_mut(&mut self) -> &mut InternalNode { let ptr = Self::as_internal_ptr(self); @@ -629,7 +629,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { } } -impl<'a, K, V> NodeRef, K, V, marker::Internal> { +impl NodeRef, K, V, marker::Internal> { /// # Safety /// Every item returned by `range` is a valid edge index for the node. unsafe fn correct_childrens_parent_links>(&mut self, range: R) { @@ -934,7 +934,7 @@ impl } } -impl<'a, K, V, NodeType, HandleType> Handle, K, V, NodeType>, HandleType> { +impl Handle, K, V, NodeType>, HandleType> { /// Temporarily takes out another mutable handle on the same location. Beware, as /// this method is very dangerous, doubly so since it might not immediately appear /// dangerous. @@ -1105,7 +1105,7 @@ impl<'a, K: 'a, V: 'a> Handle, K, V, marker::Leaf>, mark } } -impl<'a, K, V> Handle, K, V, marker::Internal>, marker::Edge> { +impl Handle, K, V, marker::Internal>, marker::Edge> { /// Fixes the parent pointer and index in the child node that this edge /// links to. This is useful when the ordering of edges has been changed, fn correct_parent_link(self) { @@ -1989,10 +1989,10 @@ pub(crate) mod marker { const TRAVERSAL_PERMIT: bool = false; } impl BorrowType for Dying {} - impl<'a> BorrowType for Immut<'a> {} + impl BorrowType for Immut<'_> {} impl BorrowType for Raw {} - impl<'a> BorrowType for Mut<'a> {} - impl<'a> BorrowType for ValMut<'a> {} + impl BorrowType for Mut<'_> {} + impl BorrowType for ValMut<'_> {} impl BorrowType for DormantMut {} pub(crate) enum KV {} diff --git a/crates/rune-alloc/src/btree/set.rs b/crates/rune-alloc/src/btree/set.rs index 0c9a52abd..050d8342c 100644 --- a/crates/rune-alloc/src/btree/set.rs +++ b/crates/rune-alloc/src/btree/set.rs @@ -1365,9 +1365,9 @@ where } } -impl<'a, T, F, A: Allocator> Iterator for ExtractIf<'_, T, F, A> +impl Iterator for ExtractIf<'_, T, F, A> where - F: 'a + FnMut(&T) -> bool, + F: FnMut(&T) -> bool, { type Item = T; diff --git a/crates/rune-alloc/src/hashbrown/map.rs b/crates/rune-alloc/src/hashbrown/map.rs index 0892fe5f4..16ea9ee59 100644 --- a/crates/rune-alloc/src/hashbrown/map.rs +++ b/crates/rune-alloc/src/hashbrown/map.rs @@ -4707,7 +4707,7 @@ impl<'a, K, Q: ?Sized> KeyOrRef<'a, K, Q> { } } -impl<'a, K: Borrow, Q: ?Sized> AsRef for KeyOrRef<'a, K, Q> { +impl, Q: ?Sized> AsRef for KeyOrRef<'_, K, Q> { fn as_ref(&self) -> &Q { match self { Self::Borrowed(borrowed) => borrowed, @@ -4771,7 +4771,7 @@ pub struct OccupiedEntryRef<'a, 'b, K, Q: ?Sized, V, S, A: Allocator = Global> { table: &'a mut HashMap, } -unsafe impl<'a, 'b, K, Q, V, S, A> Send for OccupiedEntryRef<'a, 'b, K, Q, V, S, A> +unsafe impl Send for OccupiedEntryRef<'_, '_, K, Q, V, S, A> where K: Send, Q: Sync + ?Sized, @@ -4780,7 +4780,7 @@ where A: Send + Allocator, { } -unsafe impl<'a, 'b, K, Q, V, S, A> Sync for OccupiedEntryRef<'a, 'b, K, Q, V, S, A> +unsafe impl Sync for OccupiedEntryRef<'_, '_, K, Q, V, S, A> where K: Sync, Q: Sync + ?Sized, @@ -4889,7 +4889,7 @@ impl Debug for OccupiedError<'_, K, V, S, A } } -impl<'a, K: Debug, V: Debug, S, A: Allocator> fmt::Display for OccupiedError<'a, K, V, S, A> { +impl fmt::Display for OccupiedError<'_, K, V, S, A> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, @@ -5174,7 +5174,7 @@ impl fmt::Debug for ValuesMut<'_, K, V> { } } -impl<'a, K, V, A: Allocator> Iterator for Drain<'a, K, V, A> { +impl Iterator for Drain<'_, K, V, A> { type Item = (K, V); #[cfg_attr(feature = "inline-more", inline)] diff --git a/crates/rune-alloc/src/hashbrown/raw/bitmask.rs b/crates/rune-alloc/src/hashbrown/raw/bitmask.rs index 0c4bc9e35..8efc9b3c6 100644 --- a/crates/rune-alloc/src/hashbrown/raw/bitmask.rs +++ b/crates/rune-alloc/src/hashbrown/raw/bitmask.rs @@ -111,7 +111,6 @@ impl BitMaskIter { /// Returns the bit's previous state. #[inline] #[allow(clippy::cast_ptr_alignment)] - pub(crate) unsafe fn flip(&mut self, index: usize) -> bool { // NOTE: The + BITMASK_STRIDE - 1 is to set the high bit. let mask = 1 << (index * BITMASK_STRIDE + BITMASK_STRIDE - 1); diff --git a/crates/rune-alloc/src/hashbrown/serde.rs b/crates/rune-alloc/src/hashbrown/serde.rs index fef3e60c1..dc07eb61e 100644 --- a/crates/rune-alloc/src/hashbrown/serde.rs +++ b/crates/rune-alloc/src/hashbrown/serde.rs @@ -191,7 +191,7 @@ mod set { where A: Allocator; - impl<'a, 'de, T, S, A> Visitor<'de> for SeqInPlaceVisitor<'a, T, S, A> + impl<'de, T, S, A> Visitor<'de> for SeqInPlaceVisitor<'_, T, S, A> where T: Deserialize<'de> + Eq + Hash, S: BuildHasher + Default, diff --git a/crates/rune-alloc/src/hashbrown/set.rs b/crates/rune-alloc/src/hashbrown/set.rs index d0e84005b..b34ba6eda 100644 --- a/crates/rune-alloc/src/hashbrown/set.rs +++ b/crates/rune-alloc/src/hashbrown/set.rs @@ -1676,7 +1676,7 @@ impl<'a, K> Iterator for Iter<'a, K> { self.iter.size_hint() } } -impl<'a, K> ExactSizeIterator for Iter<'a, K> { +impl ExactSizeIterator for Iter<'_, K> { #[cfg_attr(feature = "inline-more", inline)] fn len(&self) -> usize { self.iter.len() diff --git a/crates/rune-alloc/src/serde/de.rs b/crates/rune-alloc/src/serde/de.rs index 71e5be784..a6e4c6fc0 100644 --- a/crates/rune-alloc/src/serde/de.rs +++ b/crates/rune-alloc/src/serde/de.rs @@ -32,7 +32,7 @@ mod seed { /// Wraps a mutable reference and calls deserialize_in_place on it. pub struct InPlaceSeed<'a, T: 'a>(pub &'a mut T); - impl<'a, 'de, T> DeserializeSeed<'de> for InPlaceSeed<'a, T> + impl<'de, T> DeserializeSeed<'de> for InPlaceSeed<'_, T> where T: Deserialize<'de>, { @@ -117,7 +117,7 @@ where { struct VecInPlaceVisitor<'a, T: 'a>(&'a mut Vec); - impl<'a, 'de, T> Visitor<'de> for VecInPlaceVisitor<'a, T> + impl<'de, T> Visitor<'de> for VecInPlaceVisitor<'_, T> where T: Deserialize<'de>, { diff --git a/crates/rune-alloc/src/slice.rs b/crates/rune-alloc/src/slice.rs index 76b63fc42..b9acace4f 100644 --- a/crates/rune-alloc/src/slice.rs +++ b/crates/rune-alloc/src/slice.rs @@ -144,7 +144,7 @@ pub(crate) mod hack { num_init: usize, } - impl<'a, T, A: Allocator> Drop for DropGuard<'a, T, A> { + impl Drop for DropGuard<'_, T, A> { #[inline] fn drop(&mut self) { // SAFETY: diff --git a/crates/rune-alloc/src/string/mod.rs b/crates/rune-alloc/src/string/mod.rs index 1a7b79b09..887cb70bb 100644 --- a/crates/rune-alloc/src/string/mod.rs +++ b/crates/rune-alloc/src/string/mod.rs @@ -1216,7 +1216,7 @@ impl String { del_bytes: usize, } - impl<'a, A: Allocator> Drop for SetLenOnDrop<'a, A> { + impl Drop for SetLenOnDrop<'_, A> { fn drop(&mut self) { let new_len = self.idx - self.del_bytes; debug_assert!(new_len <= self.s.len()); @@ -2279,7 +2279,7 @@ impl Drop for Drain<'_, A> { } } -impl<'a, A: Allocator> Drain<'a, A> { +impl Drain<'_, A> { /// Returns the remaining (sub)string of this iterator as a slice. /// /// # Examples @@ -2300,13 +2300,13 @@ impl<'a, A: Allocator> Drain<'a, A> { } } -impl<'a, A: Allocator> AsRef for Drain<'a, A> { +impl AsRef for Drain<'_, A> { fn as_ref(&self) -> &str { self.as_str() } } -impl<'a, A: Allocator> AsRef<[u8]> for Drain<'a, A> { +impl AsRef<[u8]> for Drain<'_, A> { fn as_ref(&self) -> &[u8] { self.as_str().as_bytes() } diff --git a/crates/rune-alloc/src/string/serde.rs b/crates/rune-alloc/src/string/serde.rs index 68051eccd..71f1f486e 100644 --- a/crates/rune-alloc/src/string/serde.rs +++ b/crates/rune-alloc/src/string/serde.rs @@ -41,7 +41,7 @@ impl<'de> de::Deserialize<'de> for Box { } } -impl<'de, 'a, T: ?Sized> de::Deserialize<'de> for Cow<'a, T> +impl<'de, T: ?Sized> de::Deserialize<'de> for Cow<'_, T> where T: TryToOwned, T::Owned: de::Deserialize<'de>, @@ -58,7 +58,7 @@ where struct StringVisitor; struct StringInPlaceVisitor<'a>(&'a mut String); -impl<'de> de::Visitor<'de> for StringVisitor { +impl de::Visitor<'_> for StringVisitor { type Value = String; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -105,7 +105,7 @@ impl<'de> de::Visitor<'de> for StringVisitor { } } -impl<'a, 'de> de::Visitor<'de> for StringInPlaceVisitor<'a> { +impl de::Visitor<'_> for StringInPlaceVisitor<'_> { type Value = (); fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/crates/rune-alloc/src/vec/drain.rs b/crates/rune-alloc/src/vec/drain.rs index 2918bbafa..c6c798e7d 100644 --- a/crates/rune-alloc/src/vec/drain.rs +++ b/crates/rune-alloc/src/vec/drain.rs @@ -36,7 +36,7 @@ impl fmt::Debug for Drain<'_, T, A> { } } -impl<'a, T, A: Allocator> Drain<'a, T, A> { +impl Drain<'_, T, A> { /// Returns the remaining items of this iterator as a slice. /// /// # Examples @@ -130,7 +130,7 @@ impl<'a, T, A: Allocator> Drain<'a, T, A> { } } -impl<'a, T, A: Allocator> AsRef<[T]> for Drain<'a, T, A> { +impl AsRef<[T]> for Drain<'_, T, A> { fn as_ref(&self) -> &[T] { self.as_slice() } @@ -168,7 +168,7 @@ impl Drop for Drain<'_, T, A> { /// Moves back the un-`Drain`ed elements to restore the original `Vec`. struct DropGuard<'r, 'a, T, A: Allocator>(&'r mut Drain<'a, T, A>); - impl<'r, 'a, T, A: Allocator> Drop for DropGuard<'r, 'a, T, A> { + impl Drop for DropGuard<'_, '_, T, A> { fn drop(&mut self) { if self.0.tail_len > 0 { unsafe { diff --git a/crates/rune-alloc/src/vec/mod.rs b/crates/rune-alloc/src/vec/mod.rs index 40c680de2..9b8940cef 100644 --- a/crates/rune-alloc/src/vec/mod.rs +++ b/crates/rune-alloc/src/vec/mod.rs @@ -1629,7 +1629,7 @@ impl Vec { vec: &'a mut Vec, } - impl<'a, T, A: Allocator> Drop for FillGapOnDrop<'a, T, A> { + impl Drop for FillGapOnDrop<'_, T, A> { fn drop(&mut self) { /* This code gets executed when `same_bucket` panics */ diff --git a/crates/rune-alloc/src/vec_deque/drain.rs b/crates/rune-alloc/src/vec_deque/drain.rs index 2fc0f2195..01c46fdf3 100644 --- a/crates/rune-alloc/src/vec_deque/drain.rs +++ b/crates/rune-alloc/src/vec_deque/drain.rs @@ -86,7 +86,7 @@ impl Drop for Drain<'_, T, A> { fn drop(&mut self) { struct DropGuard<'r, 'a, T, A: Allocator>(&'r mut Drain<'a, T, A>); - impl<'r, 'a, T, A: Allocator> Drop for DropGuard<'r, 'a, T, A> { + impl Drop for DropGuard<'_, '_, T, A> { fn drop(&mut self) { if self.0.remaining != 0 { unsafe { diff --git a/crates/rune-alloc/src/vec_deque/into_iter.rs b/crates/rune-alloc/src/vec_deque/into_iter.rs index 5e8de292b..6c7b57b00 100644 --- a/crates/rune-alloc/src/vec_deque/into_iter.rs +++ b/crates/rune-alloc/src/vec_deque/into_iter.rs @@ -77,7 +77,7 @@ impl Iterator for IntoIter { consumed: usize, } - impl<'a, T, A: Allocator> Drop for Guard<'a, T, A> { + impl Drop for Guard<'_, T, A> { fn drop(&mut self) { self.deque.len -= self.consumed; self.deque.head = self.deque.to_physical_idx(self.consumed); @@ -134,7 +134,7 @@ impl DoubleEndedIterator for IntoIter { consumed: usize, } - impl<'a, T, A: Allocator> Drop for Guard<'a, T, A> { + impl Drop for Guard<'_, T, A> { fn drop(&mut self) { self.deque.len -= self.consumed; } diff --git a/crates/rune-alloc/src/vec_deque/mod.rs b/crates/rune-alloc/src/vec_deque/mod.rs index d2409f6d5..6e6e1f86d 100644 --- a/crates/rune-alloc/src/vec_deque/mod.rs +++ b/crates/rune-alloc/src/vec_deque/mod.rs @@ -144,7 +144,7 @@ impl Drop for VecDeque { /// during unwinding). struct Dropper<'a, T>(&'a mut [T]); - impl<'a, T> Drop for Dropper<'a, T> { + impl Drop for Dropper<'_, T> { fn drop(&mut self) { unsafe { ptr::drop_in_place(self.0); @@ -923,7 +923,7 @@ impl VecDeque { /// during unwinding). struct Dropper<'a, T>(&'a mut [T]); - impl<'a, T> Drop for Dropper<'a, T> { + impl Drop for Dropper<'_, T> { fn drop(&mut self) { unsafe { ptr::drop_in_place(self.0); diff --git a/crates/rune-core/src/item/iter.rs b/crates/rune-core/src/item/iter.rs index 5811fed3a..d4fd0a778 100644 --- a/crates/rune-core/src/item/iter.rs +++ b/crates/rune-core/src/item/iter.rs @@ -102,7 +102,7 @@ impl<'a> Iterator for Iter<'a> { } } -impl<'a> DoubleEndedIterator for Iter<'a> { +impl DoubleEndedIterator for Iter<'_> { fn next_back(&mut self) -> Option { if self.content.is_empty() { return None; diff --git a/crates/rune/src/ast/path.rs b/crates/rune/src/ast/path.rs index 376064a29..f7d080d6f 100644 --- a/crates/rune/src/ast/path.rs +++ b/crates/rune/src/ast/path.rs @@ -94,7 +94,7 @@ impl IntoExpectation for &Path { } /// Resolve implementation for path which "stringifies" it. -impl<'a> Resolve<'a> for Path { +impl Resolve<'_> for Path { type Output = Box; fn resolve(&self, cx: ResolveContext<'_>) -> Result { diff --git a/crates/rune/src/build.rs b/crates/rune/src/build.rs index 6825314be..ce7f5293d 100644 --- a/crates/rune/src/build.rs +++ b/crates/rune/src/build.rs @@ -164,7 +164,7 @@ struct CompileVisitorGroup<'a> { visitors: Vec<&'a mut dyn compile::CompileVisitor>, } -impl<'a> compile::CompileVisitor for CompileVisitorGroup<'a> { +impl compile::CompileVisitor for CompileVisitorGroup<'_> { fn register_meta(&mut self, meta: compile::MetaRef<'_>) -> Result<(), MetaError> { for v in self.visitors.iter_mut() { v.register_meta(meta)?; diff --git a/crates/rune/src/compile/attrs.rs b/crates/rune/src/compile/attrs.rs index 5e4fe489b..a4afabb83 100644 --- a/crates/rune/src/compile/attrs.rs +++ b/crates/rune/src/compile/attrs.rs @@ -97,7 +97,7 @@ pub(crate) struct ParseAll<'this, 'a, T> { _marker: PhantomData, } -impl<'this, 'a, T> Iterator for ParseAll<'this, 'a, T> +impl<'a, T> Iterator for ParseAll<'_, 'a, T> where T: Attribute + Parse, { diff --git a/crates/rune/src/compile/v1/assemble.rs b/crates/rune/src/compile/v1/assemble.rs index 6fcfc9897..ae2719467 100644 --- a/crates/rune/src/compile/v1/assemble.rs +++ b/crates/rune/src/compile/v1/assemble.rs @@ -70,7 +70,7 @@ pub(crate) struct Ctxt<'a, 'hir, 'arena> { pub(crate) drop: Vec, } -impl<'a, 'hir, 'arena> Ctxt<'a, 'hir, 'arena> { +impl<'hir> Ctxt<'_, 'hir, '_> { fn drop_dangling(&mut self, span: &dyn Spanned) -> compile::Result<()> { self.scopes .drain_dangling_into(&mut self.drop) @@ -178,7 +178,7 @@ impl<'hir, T> Asm<'hir, T> { fn ignore(self) {} } -impl<'hir, T> Asm<'hir, T> { +impl Asm<'_, T> { /// Test if the assembly converges and return the data associated with it. #[inline] fn into_converging(self) -> Option { diff --git a/crates/rune/src/compile/v1/linear.rs b/crates/rune/src/compile/v1/linear.rs index e06036639..a5b685c4c 100644 --- a/crates/rune/src/compile/v1/linear.rs +++ b/crates/rune/src/compile/v1/linear.rs @@ -119,7 +119,7 @@ impl<'a, 'hir> Deref for Linear<'a, 'hir> { } } -impl<'a, 'hir> DerefMut for Linear<'a, 'hir> { +impl DerefMut for Linear<'_, '_> { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { match &mut self.addresses { @@ -172,7 +172,7 @@ impl<'a, 'hir> Iterator for IntoIter<'a, 'hir> { } } -impl<'a, 'hir> ExactSizeIterator for IntoIter<'a, 'hir> { +impl ExactSizeIterator for IntoIter<'_, '_> { #[inline] fn len(&self) -> usize { match &self.inner { @@ -182,7 +182,7 @@ impl<'a, 'hir> ExactSizeIterator for IntoIter<'a, 'hir> { } } -impl<'a, 'hir> DoubleEndedIterator for IntoIter<'a, 'hir> { +impl DoubleEndedIterator for IntoIter<'_, '_> { #[inline] fn next_back(&mut self) -> Option { match &mut self.inner { diff --git a/crates/rune/src/compile/v1/scopes.rs b/crates/rune/src/compile/v1/scopes.rs index 82417313e..7f54a490c 100644 --- a/crates/rune/src/compile/v1/scopes.rs +++ b/crates/rune/src/compile/v1/scopes.rs @@ -27,7 +27,7 @@ pub(super) struct Scope<'hir> { locals: Dangling, } -impl<'hir> Scope<'hir> { +impl Scope<'_> { /// Construct a new locals handlers. fn new(parent: ScopeId, id: ScopeId) -> Self { Self { @@ -600,14 +600,14 @@ impl fmt::Debug for Var<'_> { } } -impl<'hir> fmt::Display for Var<'hir> { +impl fmt::Display for Var<'_> { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.name.fmt(f) } } -impl<'hir> Var<'hir> { +impl Var<'_> { /// Copy the declared variable. pub(super) fn copy( &self, diff --git a/crates/rune/src/doc/markdown.rs b/crates/rune/src/doc/markdown.rs index d6813eb37..07e802adf 100644 --- a/crates/rune/src/doc/markdown.rs +++ b/crates/rune/src/doc/markdown.rs @@ -51,7 +51,7 @@ struct Writer<'a, 'o, I> { numbers: HashMap, usize>, } -impl<'a, 'o, I> Writer<'a, 'o, I> +impl<'a, I> Writer<'a, '_, I> where I: Iterator>, { diff --git a/crates/rune/src/grammar/parser.rs b/crates/rune/src/grammar/parser.rs index 6af5590d7..2cc60f1f7 100644 --- a/crates/rune/src/grammar/parser.rs +++ b/crates/rune/src/grammar/parser.rs @@ -389,7 +389,7 @@ enum SourceInner<'a> { Node(NodeSource<'a>), } -impl<'a> Advance for Parser<'a> { +impl Advance for Parser<'_> { type Error = Error; #[inline] diff --git a/crates/rune/src/grammar/tree.rs b/crates/rune/src/grammar/tree.rs index 44a0115d9..296bb5b81 100644 --- a/crates/rune/src/grammar/tree.rs +++ b/crates/rune/src/grammar/tree.rs @@ -1157,7 +1157,8 @@ impl<'a> Remaining<'a> { } } -impl<'a> Default for Remaining<'a> { +impl Default for Remaining<'_> { + #[inline] fn default() -> Self { Self { inside: Kind::Root, @@ -1203,7 +1204,7 @@ impl<'a> Iterator for Iter<'a> { } } -impl<'a> DoubleEndedIterator for Iter<'a> { +impl DoubleEndedIterator for Iter<'_> { fn next_back(&mut self) -> Option { let node = self.last.take()?; diff --git a/crates/rune/src/hir/arena.rs b/crates/rune/src/hir/arena.rs index aff8844c7..8f74d3b2f 100644 --- a/crates/rune/src/hir/arena.rs +++ b/crates/rune/src/hir/arena.rs @@ -98,9 +98,7 @@ impl Arena { // SAFETY: we're ensuring the valid contents of the returned string by // safely accessing it above. - unsafe { - return Ok(str::from_utf8_unchecked(bytes)); - } + unsafe { Ok(str::from_utf8_unchecked(bytes)) } } /// Allocate a new object of the given type. diff --git a/crates/rune/src/hir/hir.rs b/crates/rune/src/hir/hir.rs index be592b38e..13531c36c 100644 --- a/crates/rune/src/hir/hir.rs +++ b/crates/rune/src/hir/hir.rs @@ -154,7 +154,7 @@ pub(crate) enum Binding<'hir> { Ident(Span, &'hir str, Variable), } -impl<'hir> Spanned for Binding<'hir> { +impl Spanned for Binding<'_> { fn span(&self) -> Span { match self { Binding::Binding(span, _, _) => *span, diff --git a/crates/rune/src/hir/lowering2.rs b/crates/rune/src/hir/lowering2.rs index 763779be4..6e9f51690 100644 --- a/crates/rune/src/hir/lowering2.rs +++ b/crates/rune/src/hir/lowering2.rs @@ -297,7 +297,7 @@ enum ExprInnerKind<'hir, 'a> { Path(StreamBuf<'a>), } -impl<'hir, 'a> ExprInner<'hir, 'a> { +impl<'hir> ExprInner<'hir, '_> { fn into_call(self, cx: &mut Ctxt<'hir, '_, '_>, args: usize) -> Result> { match self.kind { ExprInnerKind::Path(p) => { diff --git a/crates/rune/src/indexing/indexer.rs b/crates/rune/src/indexing/indexer.rs index ce0c8d777..e78946c9c 100644 --- a/crates/rune/src/indexing/indexer.rs +++ b/crates/rune/src/indexing/indexer.rs @@ -72,7 +72,7 @@ impl<'a> Ignore<'a> for Indexer<'_, '_> { } } -impl<'a, 'arena> Indexer<'a, 'arena> { +impl Indexer<'_, '_> { /// Push an identifier item. pub(super) fn push_id(&mut self) -> alloc::Result { let id = self.q.pool.next_id(self.item.id); diff --git a/crates/rune/src/languageserver/envelope.rs b/crates/rune/src/languageserver/envelope.rs index 1ba2e95e3..654d9c3db 100644 --- a/crates/rune/src/languageserver/envelope.rs +++ b/crates/rune/src/languageserver/envelope.rs @@ -117,6 +117,7 @@ pub(super) struct ResponseError<'a, D> { pub(super) struct V2; impl serde::Serialize for V2 { + #[inline] fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -126,21 +127,22 @@ impl serde::Serialize for V2 { } impl<'a> serde::Deserialize<'a> for V2 { + #[inline] fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'a>, { - return deserializer.deserialize_identifier(Visitor); - struct Visitor; - impl<'a> serde::de::Visitor<'a> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = V2; + #[inline] fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("a string") } + #[inline] fn visit_str(self, value: &str) -> Result where E: serde::de::Error, @@ -151,5 +153,7 @@ impl<'a> serde::Deserialize<'a> for V2 { } } } + + deserializer.deserialize_identifier(Visitor) } } diff --git a/crates/rune/src/languageserver/state.rs b/crates/rune/src/languageserver/state.rs index c9b5bc200..ffe0b9724 100644 --- a/crates/rune/src/languageserver/state.rs +++ b/crates/rune/src/languageserver/state.rs @@ -1199,7 +1199,7 @@ impl<'a> ScriptSourceLoader<'a> { } } -impl<'a> crate::compile::SourceLoader for ScriptSourceLoader<'a> { +impl crate::compile::SourceLoader for ScriptSourceLoader<'_> { fn load(&mut self, root: &Path, item: &Item, span: &dyn Spanned) -> compile::Result { tracing::trace!("load {} (root: {})", item, root.display()); @@ -1230,7 +1230,7 @@ impl<'a> WorkspaceSourceLoader<'a> { } } -impl<'a> workspace::SourceLoader for WorkspaceSourceLoader<'a> { +impl workspace::SourceLoader for WorkspaceSourceLoader<'_> { fn load(&mut self, span: Span, path: &Path) -> Result { if let Ok(url) = crate::languageserver::url::from_file_path(path) { if let Some(s) = self.sources.get(&url) { diff --git a/crates/rune/src/macros/quote_fn.rs b/crates/rune/src/macros/quote_fn.rs index bb3eaaae2..d7843b827 100644 --- a/crates/rune/src/macros/quote_fn.rs +++ b/crates/rune/src/macros/quote_fn.rs @@ -18,7 +18,7 @@ where /// [ToTokens] implementation generated by [quote_fn]. pub struct Quote<'a>(rust_alloc::boxed::Box>); -impl<'a> Quote<'a> { +impl Quote<'_> { /// Convert into token stream. /// /// # Panics @@ -34,7 +34,7 @@ impl<'a> Quote<'a> { } } -impl<'a> ToTokens for Quote<'a> { +impl ToTokens for Quote<'_> { fn to_tokens( &self, context: &mut MacroContext<'_, '_, '_>, @@ -44,7 +44,7 @@ impl<'a> ToTokens for Quote<'a> { } } -impl<'a> fmt::Debug for Quote<'a> { +impl fmt::Debug for Quote<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("Quote").finish() } diff --git a/crates/rune/src/modules/fmt.rs b/crates/rune/src/modules/fmt.rs index 19d67a9ee..046a9798b 100644 --- a/crates/rune/src/modules/fmt.rs +++ b/crates/rune/src/modules/fmt.rs @@ -76,11 +76,8 @@ pub(crate) fn format( /// ``` #[rune::function(keep, instance, protocol = DISPLAY_FMT)] fn format_display_fmt(format: &Format, f: &mut Formatter) -> VmResult<()> { - VmResult::Ok(vm_try!(format.spec.format( - &format.value, - f, - &mut EnvProtocolCaller - ))) + vm_try!(format.spec.format(&format.value, f, &mut EnvProtocolCaller)); + VmResult::Ok(()) } /// Write a debug representation of a format specification. @@ -94,7 +91,7 @@ fn format_display_fmt(format: &Format, f: &mut Formatter) -> VmResult<()> { /// ``` #[rune::function(keep, instance, protocol = DEBUG_FMT)] fn format_debug_fmt(format: &Format, f: &mut Formatter) -> VmResult<()> { - VmResult::Ok(vm_try!(vm_write!(f, "{format:?}"))) + vm_write!(f, "{format:?}") } /// Clones a format specification. diff --git a/crates/rune/src/parse/parser.rs b/crates/rune/src/parse/parser.rs index b6eeaf9ce..b843a29df 100644 --- a/crates/rune/src/parse/parser.rs +++ b/crates/rune/src/parse/parser.rs @@ -233,7 +233,7 @@ pub struct Peeker<'a> { default_span: Span, } -impl<'a> Peeker<'a> { +impl Peeker<'_> { /// Peek the token kind at the given position. pub(crate) fn nth(&mut self, n: usize) -> Kind { // Error tripped already, this peeker returns nothing but errors from @@ -396,7 +396,7 @@ enum SourceInner<'a> { TokenStream(TokenStreamIter<'a>), } -impl<'a> Advance for Parser<'a> { +impl Advance for Parser<'_> { type Error = compile::Error; #[inline] diff --git a/crates/rune/src/query/query.rs b/crates/rune/src/query/query.rs index 427143bf5..f53407397 100644 --- a/crates/rune/src/query/query.rs +++ b/crates/rune/src/query/query.rs @@ -96,7 +96,7 @@ impl<'a, 'arena> Deref for QuerySource<'a, 'arena> { } } -impl<'a, 'arena> DerefMut for QuerySource<'a, 'arena> { +impl DerefMut for QuerySource<'_, '_> { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.query diff --git a/crates/rune/src/runtime/bytes.rs b/crates/rune/src/runtime/bytes.rs index 325f8ce2f..099fbb3ac 100644 --- a/crates/rune/src/runtime/bytes.rs +++ b/crates/rune/src/runtime/bytes.rs @@ -422,7 +422,7 @@ impl<'de> de::Deserialize<'de> for Bytes { { struct Visitor; - impl<'de> de::Visitor<'de> for Visitor { + impl de::Visitor<'_> for Visitor { type Value = Bytes; #[inline] diff --git a/crates/rune/src/runtime/unit/byte_code.rs b/crates/rune/src/runtime/unit/byte_code.rs index e8a743a1c..c2c2f3076 100644 --- a/crates/rune/src/runtime/unit/byte_code.rs +++ b/crates/rune/src/runtime/unit/byte_code.rs @@ -26,7 +26,7 @@ pub struct ByteCodeUnitIter<'a> { len: usize, } -impl<'a> Iterator for ByteCodeUnitIter<'a> { +impl Iterator for ByteCodeUnitIter<'_> { type Item = (usize, Inst); #[inline] diff --git a/crates/rune/src/runtime/value.rs b/crates/rune/src/runtime/value.rs index 8f16b2157..55944e2ad 100644 --- a/crates/rune/src/runtime/value.rs +++ b/crates/rune/src/runtime/value.rs @@ -349,7 +349,8 @@ impl Value { let result = vm_try!(caller.call_protocol_fn(&Protocol::DISPLAY_FMT, self.clone(), &mut args)); - VmResult::Ok(vm_try!(<()>::from_value(result))) + vm_try!(<()>::from_value(result)); + VmResult::Ok(()) } /// Perform a shallow clone of the value using the [`CLONE`] protocol. @@ -1201,7 +1202,10 @@ impl Value { caller: &mut dyn ProtocolCaller, ) -> VmResult<()> { match self.as_ref() { - Repr::Inline(value) => return VmResult::Ok(vm_try!(value.hash(hasher))), + Repr::Inline(value) => { + vm_try!(value.hash(hasher)); + return VmResult::Ok(()); + } Repr::Any(value) => match value.type_hash() { Vec::HASH => { let vec = vm_try!(value.borrow_ref::()); @@ -1221,7 +1225,8 @@ impl Value { if let CallResultOnly::Ok(value) = vm_try!(caller.try_call_protocol_fn(&Protocol::HASH, self.clone(), &mut args)) { - return VmResult::Ok(vm_try!(<_>::from_value(value))); + vm_try!(<()>::from_value(value)); + return VmResult::Ok(()); } err(VmErrorKind::UnsupportedUnaryOperation { diff --git a/crates/rune/src/runtime/value/rtti.rs b/crates/rune/src/runtime/value/rtti.rs index 479f479eb..42446d5c8 100644 --- a/crates/rune/src/runtime/value/rtti.rs +++ b/crates/rune/src/runtime/value/rtti.rs @@ -19,7 +19,7 @@ pub struct Accessor<'a> { pub(crate) data: &'a [Value], } -impl<'a> Accessor<'a> { +impl Accessor<'_> { /// Get a field through the accessor. #[doc(hidden)] pub fn get(&self, key: &Q) -> Option<&Value> diff --git a/crates/rune/src/runtime/vm_error.rs b/crates/rune/src/runtime/vm_error.rs index 8e7a6b2b1..94588b68a 100644 --- a/crates/rune/src/runtime/vm_error.rs +++ b/crates/rune/src/runtime/vm_error.rs @@ -123,6 +123,8 @@ pub trait TryFromResult: self::sealed::Sealed { /// Despite being public, this is actually private API (`#[doc(hidden)]`). Use /// at your own risk. #[doc(hidden)] +#[inline(always)] +#[allow(clippy::unit_arg)] pub fn try_result(result: T) -> VmResult where T: TryFromResult, diff --git a/crates/rune/src/workspace/glob.rs b/crates/rune/src/workspace/glob.rs index 049839e18..d94b7b883 100644 --- a/crates/rune/src/workspace/glob.rs +++ b/crates/rune/src/workspace/glob.rs @@ -168,7 +168,7 @@ pub(crate) struct Matcher<'a> { queue: VecDeque<(PathBuf, &'a [Component<'a>])>, } -impl<'a> Iterator for Matcher<'a> { +impl Iterator for Matcher<'_> { type Item = Result; fn next(&mut self) -> Option { diff --git a/crates/rune/src/workspace/spanned_value.rs b/crates/rune/src/workspace/spanned_value.rs index 1c4fe7be9..8e68bff62 100644 --- a/crates/rune/src/workspace/spanned_value.rs +++ b/crates/rune/src/workspace/spanned_value.rs @@ -307,7 +307,7 @@ pub(crate) trait Sealed {} impl Sealed for usize {} impl Sealed for str {} impl Sealed for String {} -impl<'a, T: Sealed + ?Sized> Sealed for &'a T {} +impl Sealed for &T {} impl Index for usize { fn index<'a>(&self, val: &'a Value) -> Option<&'a SpannedValue> { @@ -351,9 +351,9 @@ impl Index for String { } } -impl<'s, T: ?Sized> Index for &'s T +impl Index for &T where - T: Index, + T: ?Sized + Index, { fn index<'a>(&self, val: &'a Value) -> Option<&'a SpannedValue> { (**self).index(val) @@ -547,7 +547,7 @@ impl<'de> de::Deserialize<'de> for DatetimeFromString { { struct Visitor; - impl<'de> de::Visitor<'de> for Visitor { + impl de::Visitor<'_> for Visitor { type Value = DatetimeFromString; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/examples/examples/hot_reloading/path_reloader.rs b/examples/examples/hot_reloading/path_reloader.rs index e6acfe603..ea931b2b7 100644 --- a/examples/examples/hot_reloading/path_reloader.rs +++ b/examples/examples/hot_reloading/path_reloader.rs @@ -163,7 +163,7 @@ struct Inner<'a> { updates: HashMap, } -impl<'a> Inner<'a> { +impl Inner<'_> { fn reload(&mut self, events: &mut Vec) -> Result<()> { fn compile(context: &Context, path: &Path) -> Result { let mut sources = Sources::new();