Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix clippy lints #1008

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/adaptors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<I, F> fmt::Debug for TakeWhileRef<'_, I, F>
where
I: Iterator + fmt::Debug,
{
Expand All @@ -530,7 +530,7 @@ where
TakeWhileRef { iter, f }
}

impl<'a, I, F> Iterator for TakeWhileRef<'a, I, F>
impl<I, F> Iterator for TakeWhileRef<'_, I, F>
where
I: Iterator + Clone,
F: FnMut(&I::Item) -> bool,
Expand Down
14 changes: 7 additions & 7 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
}
}

impl<'a, I, F> fmt::Display for FormatWith<'a, I, F>
impl<I, F> fmt::Display for FormatWith<'_, I, F>
where
I: Iterator,
F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result,
Expand All @@ -71,7 +71,7 @@ where
}
}

impl<'a, I, F> fmt::Debug for FormatWith<'a, I, F>
impl<I, F> fmt::Debug for FormatWith<'_, I, F>
where
I: Iterator,
F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result,
Expand All @@ -81,7 +81,7 @@ where
}
}

impl<'a, I> Format<'a, I>
impl<I> Format<'_, I>
where
I: Iterator,
{
Expand Down Expand Up @@ -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<I, F> Clone for FormatWith<'_, I, F>
where
(I, F): Clone,
{
Expand All @@ -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<I, F> Drop for PutBackOnDrop<'_, '_, I, F> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are what was called way back in the day "impl header lifetime elision": rust-lang/rust#15872 (comment)

Each mention of '_ is a fresh lifetime, like in fn foo(x: &'_ T, y: &'_ T).

fn drop(&mut self) {
self.into.inner.set(self.inner.take())
}
Expand All @@ -151,7 +151,7 @@ where
}
}

impl<'a, I> Clone for Format<'a, I>
impl<I> Clone for Format<'_, I>
where
I: Clone,
{
Expand All @@ -161,7 +161,7 @@ where
inner: Option<I>,
}
// This ensures we preserve the state of the original `FormatWith` if `Clone` panics
impl<'r, 'a, I> Drop for PutBackOnDrop<'r, 'a, I> {
impl<I> Drop for PutBackOnDrop<'_, '_, I> {
fn drop(&mut self) {
self.into.inner.set(self.inner.take())
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<J, F>(self, other: J, is_first: F) -> MergeBy<Self, J::IntoIter, F>
where
Self: Sized,
Expand Down
6 changes: 3 additions & 3 deletions src/peeking_take_while.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub trait PeekingNext: Iterator {
F: FnOnce(&Self::Item) -> bool;
}

impl<'a, I> PeekingNext for &'a mut I
impl<I> PeekingNext for &mut I
where
I: PeekingNext,
{
Expand Down Expand Up @@ -133,7 +133,7 @@ where
PeekingTakeWhile { iter, f }
}

impl<'a, I, F> Iterator for PeekingTakeWhile<'a, I, F>
impl<I, F> Iterator for PeekingTakeWhile<'_, I, F>
where
I: PeekingNext,
F: FnMut(&I::Item) -> bool,
Expand All @@ -148,7 +148,7 @@ where
}
}

impl<'a, I, F> PeekingNext for PeekingTakeWhile<'a, I, F>
impl<I, F> PeekingNext for PeekingTakeWhile<'_, I, F>
where
I: PeekingNext,
F: FnMut(&I::Item) -> bool,
Expand Down
6 changes: 3 additions & 3 deletions src/process_results_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct ProcessResults<'a, I, E: 'a> {
iter: I,
}

impl<'a, I, E> ProcessResults<'a, I, E> {
impl<I, E> ProcessResults<'_, I, E> {
#[inline(always)]
fn next_body<T>(&mut self, item: Option<Result<T, E>>) -> Option<T> {
match item {
Expand All @@ -27,7 +27,7 @@ impl<'a, I, E> ProcessResults<'a, I, E> {
}
}

impl<'a, I, T, E> Iterator for ProcessResults<'a, I, E>
impl<I, T, E> Iterator for ProcessResults<'_, I, E>
where
I: Iterator<Item = Result<T, E>>,
{
Expand Down Expand Up @@ -60,7 +60,7 @@ where
}
}

impl<'a, I, T, E> DoubleEndedIterator for ProcessResults<'a, I, E>
impl<I, T, E> DoubleEndedIterator for ProcessResults<'_, I, E>
where
I: Iterator<Item = Result<T, E>>,
I: DoubleEndedIterator,
Expand Down
2 changes: 1 addition & 1 deletion src/rciter_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ where
}

/// Return an iterator from `&RcIter<I>` (by simply cloning it).
impl<'a, I> IntoIterator for &'a RcIter<I>
impl<I> IntoIterator for &RcIter<I>
where
I: Iterator,
{
Expand Down
Loading