From 7a20c5d516bf053e00b475003c52b485eff141ee Mon Sep 17 00:00:00 2001 From: Jack Wrenn Date: Mon, 23 Dec 2024 18:53:14 +0000 Subject: [PATCH] fix clippy lints --- src/adaptors/mod.rs | 4 ++-- src/format.rs | 14 +++++++------- src/lib.rs | 1 - src/peeking_take_while.rs | 6 +++--- src/process_results_impl.rs | 6 +++--- src/rciter_impl.rs | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/adaptors/mod.rs b/src/adaptors/mod.rs index d717e5408..77192f26e 100644 --- a/src/adaptors/mod.rs +++ b/src/adaptors/mod.rs @@ -515,7 +515,7 @@ pub struct TakeWhileRef<'a, I: 'a, F> { f: F, } -impl<'a, I, F> fmt::Debug for TakeWhileRef<'a, I, F> +impl fmt::Debug for TakeWhileRef<'_, I, F> where I: Iterator + fmt::Debug, { @@ -530,7 +530,7 @@ where TakeWhileRef { iter, f } } -impl<'a, I, F> Iterator for TakeWhileRef<'a, I, F> +impl Iterator for TakeWhileRef<'_, I, F> where I: Iterator + Clone, F: FnMut(&I::Item) -> bool, diff --git a/src/format.rs b/src/format.rs index 15cee34d6..3abdda369 100644 --- a/src/format.rs +++ b/src/format.rs @@ -47,7 +47,7 @@ where } } -impl<'a, I, F> fmt::Display for FormatWith<'a, I, F> +impl fmt::Display for FormatWith<'_, I, F> where I: Iterator, F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result, @@ -71,7 +71,7 @@ where } } -impl<'a, I, F> fmt::Debug for FormatWith<'a, I, F> +impl fmt::Debug for FormatWith<'_, I, F> where I: Iterator, F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result, @@ -81,7 +81,7 @@ where } } -impl<'a, I> Format<'a, I> +impl Format<'_, I> where I: Iterator, { @@ -125,7 +125,7 @@ macro_rules! impl_format { impl_format! {Display Debug UpperExp LowerExp UpperHex LowerHex Octal Binary Pointer} -impl<'a, I, F> Clone for FormatWith<'a, I, F> +impl Clone for FormatWith<'_, I, F> where (I, F): Clone, { @@ -135,7 +135,7 @@ where inner: Option<(I, F)>, } // This ensures we preserve the state of the original `FormatWith` if `Clone` panics - impl<'r, 'a, I, F> Drop for PutBackOnDrop<'r, 'a, I, F> { + impl Drop for PutBackOnDrop<'_, '_, I, F> { fn drop(&mut self) { self.into.inner.set(self.inner.take()) } @@ -151,7 +151,7 @@ where } } -impl<'a, I> Clone for Format<'a, I> +impl Clone for Format<'_, I> where I: Clone, { @@ -161,7 +161,7 @@ where inner: Option, } // This ensures we preserve the state of the original `FormatWith` if `Clone` panics - impl<'r, 'a, I> Drop for PutBackOnDrop<'r, 'a, I> { + impl Drop for PutBackOnDrop<'_, '_, I> { fn drop(&mut self) { self.into.inner.set(self.inner.take()) } diff --git a/src/lib.rs b/src/lib.rs index 834a48dea..37c3b1f41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1055,7 +1055,6 @@ pub trait Itertools: Iterator { /// let it = a.merge_by(b, |x, y| x.1 <= y.1); /// itertools::assert_equal(it, vec![(0, 'a'), (0, 'b'), (1, 'c'), (1, 'd')]); /// ``` - fn merge_by(self, other: J, is_first: F) -> MergeBy where Self: Sized, diff --git a/src/peeking_take_while.rs b/src/peeking_take_while.rs index 19872a964..f3259a919 100644 --- a/src/peeking_take_while.rs +++ b/src/peeking_take_while.rs @@ -22,7 +22,7 @@ pub trait PeekingNext: Iterator { F: FnOnce(&Self::Item) -> bool; } -impl<'a, I> PeekingNext for &'a mut I +impl PeekingNext for &mut I where I: PeekingNext, { @@ -133,7 +133,7 @@ where PeekingTakeWhile { iter, f } } -impl<'a, I, F> Iterator for PeekingTakeWhile<'a, I, F> +impl Iterator for PeekingTakeWhile<'_, I, F> where I: PeekingNext, F: FnMut(&I::Item) -> bool, @@ -148,7 +148,7 @@ where } } -impl<'a, I, F> PeekingNext for PeekingTakeWhile<'a, I, F> +impl PeekingNext for PeekingTakeWhile<'_, I, F> where I: PeekingNext, F: FnMut(&I::Item) -> bool, diff --git a/src/process_results_impl.rs b/src/process_results_impl.rs index ad6c60d3c..31389c5fd 100644 --- a/src/process_results_impl.rs +++ b/src/process_results_impl.rs @@ -13,7 +13,7 @@ pub struct ProcessResults<'a, I, E: 'a> { iter: I, } -impl<'a, I, E> ProcessResults<'a, I, E> { +impl ProcessResults<'_, I, E> { #[inline(always)] fn next_body(&mut self, item: Option>) -> Option { match item { @@ -27,7 +27,7 @@ impl<'a, I, E> ProcessResults<'a, I, E> { } } -impl<'a, I, T, E> Iterator for ProcessResults<'a, I, E> +impl Iterator for ProcessResults<'_, I, E> where I: Iterator>, { @@ -60,7 +60,7 @@ where } } -impl<'a, I, T, E> DoubleEndedIterator for ProcessResults<'a, I, E> +impl DoubleEndedIterator for ProcessResults<'_, I, E> where I: Iterator>, I: DoubleEndedIterator, diff --git a/src/rciter_impl.rs b/src/rciter_impl.rs index e3b753206..96a0fd69c 100644 --- a/src/rciter_impl.rs +++ b/src/rciter_impl.rs @@ -87,7 +87,7 @@ where } /// Return an iterator from `&RcIter` (by simply cloning it). -impl<'a, I> IntoIterator for &'a RcIter +impl IntoIterator for &RcIter where I: Iterator, {