From 157f01564defbbf8a7f6b77135e09a7d834db547 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 19 Jan 2025 00:31:21 +0100 Subject: [PATCH] Make clippy happier (#72) --- src/algorithms/compact.rs | 8 ++------ src/algorithms/myers.rs | 2 +- src/algorithms/utils.rs | 8 ++++---- src/iter.rs | 2 +- src/text/abstraction.rs | 2 +- src/text/mod.rs | 4 ++-- src/types.rs | 2 +- src/utils.rs | 2 +- 8 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/algorithms/compact.rs b/src/algorithms/compact.rs index bd5c6c4..88de979 100644 --- a/src/algorithms/compact.rs +++ b/src/algorithms/compact.rs @@ -44,17 +44,13 @@ where } } -impl<'old, 'new, Old: ?Sized, New: ?Sized, D: DiffHook> AsRef - for Compact<'old, 'new, Old, New, D> -{ +impl AsRef for Compact<'_, '_, Old, New, D> { fn as_ref(&self) -> &D { &self.d } } -impl<'old, 'new, Old: ?Sized, New: ?Sized, D: DiffHook> AsMut - for Compact<'old, 'new, Old, New, D> -{ +impl AsMut for Compact<'_, '_, Old, New, D> { fn as_mut(&mut self) -> &mut D { &mut self.d } diff --git a/src/algorithms/myers.rs b/src/algorithms/myers.rs index 733c5ad..3cc5c75 100644 --- a/src/algorithms/myers.rs +++ b/src/algorithms/myers.rs @@ -388,7 +388,7 @@ fn test_deadline_reached() { struct SlowIndex<'a>(&'a [usize]); - impl<'a> Index for SlowIndex<'a> { + impl Index for SlowIndex<'_> { type Output = usize; fn index(&self, index: usize) -> &Self::Output { diff --git a/src/algorithms/utils.rs b/src/algorithms/utils.rs index 812f97d..76b8895 100644 --- a/src/algorithms/utils.rs +++ b/src/algorithms/utils.rs @@ -20,7 +20,7 @@ pub struct UniqueItem<'a, Idx: ?Sized> { index: usize, } -impl<'a, Idx: ?Sized> UniqueItem<'a, Idx> +impl UniqueItem<'_, Idx> where Idx: Index, { @@ -209,7 +209,7 @@ where New(&'new New), } - impl<'old, 'new, Old, New> Hash for Key<'old, 'new, Old, New> + impl Hash for Key<'_, '_, Old, New> where Old: Hash + ?Sized, New: Hash + ?Sized, @@ -222,7 +222,7 @@ where } } - impl<'old, 'new, Old, New> PartialEq for Key<'old, 'new, Old, New> + impl PartialEq for Key<'_, '_, Old, New> where Old: Eq + ?Sized, New: Eq + PartialEq + ?Sized, @@ -237,7 +237,7 @@ where } } - impl<'old, 'new, Old, New> Eq for Key<'old, 'new, Old, New> + impl Eq for Key<'_, '_, Old, New> where Old: Eq + ?Sized, New: Eq + PartialEq + ?Sized, diff --git a/src/iter.rs b/src/iter.rs index 0a1ae53..363fccc 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -50,7 +50,7 @@ where } } -impl<'lookup, Old, New, T> Iterator for ChangesIter<'lookup, Old, New, T> +impl Iterator for ChangesIter<'_, Old, New, T> where Old: Index + ?Sized, New: Index + ?Sized, diff --git a/src/text/abstraction.rs b/src/text/abstraction.rs index 08c60c0..d6e17f2 100644 --- a/src/text/abstraction.rs +++ b/src/text/abstraction.rs @@ -36,7 +36,7 @@ impl DiffableStrRef for String { } } -impl<'a, T: DiffableStr + ?Sized> DiffableStrRef for Cow<'a, T> { +impl DiffableStrRef for Cow<'_, T> { type Output = T; fn as_diffable_str(&self) -> &T { diff --git a/src/text/mod.rs b/src/text/mod.rs index a470b3e..4b5efc4 100644 --- a/src/text/mod.rs +++ b/src/text/mod.rs @@ -543,7 +543,7 @@ impl<'old, 'new, 'bufs, T: DiffableStr + ?Sized + 'old + 'new> TextDiff<'old, 'n pub fn iter_inline_changes<'slf>( &'slf self, op: &DiffOp, - ) -> impl Iterator> + '_ + ) -> impl Iterator> + 'slf where 'slf: 'old + 'new, { @@ -558,7 +558,7 @@ impl<'old, 'new, 'bufs, T: DiffableStr + ?Sized + 'old + 'new> TextDiff<'old, 'n &'slf self, op: &DiffOp, deadline: Option, - ) -> impl Iterator> + '_ + ) -> impl Iterator> + 'slf where 'slf: 'old + 'new, { diff --git a/src/types.rs b/src/types.rs index 1a97add..4399a68 100644 --- a/src/types.rs +++ b/src/types.rs @@ -489,7 +489,7 @@ mod text_additions { } } - impl<'s, T: DiffableStr + ?Sized> fmt::Display for Change<&'s T> { + impl fmt::Display for Change<&T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, diff --git a/src/utils.rs b/src/utils.rs index c95f453..7b2cdb3 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -58,7 +58,7 @@ impl<'x, T: DiffableStr + ?Sized> SliceRemapper<'x, T> { } } -impl<'x, T: DiffableStr + ?Sized> Index> for SliceRemapper<'x, T> { +impl Index> for SliceRemapper<'_, T> { type Output = T; fn index(&self, range: Range) -> &Self::Output {