Skip to content

Commit 1fb979b

Browse files
hellow554Philippe-Cholet
authored andcommitted
fix clippy::type_repetition_in_bounds
https://rust-lang.github.io/rust-clippy/master/index.html#/type_repetition_in_bounds `CircularTupleWindows` even had a duplicate bound. Co-Authored-By: Marcel Hellwig <[email protected]>
1 parent 2c487f0 commit 1fb979b

File tree

8 files changed

+29
-26
lines changed

8 files changed

+29
-26
lines changed

src/adaptors/coalesce.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ where
1717
f: F,
1818
}
1919

20-
impl<I: Clone, F: Clone, C> Clone for CoalesceBy<I, F, C>
20+
impl<I, F, C> Clone for CoalesceBy<I, F, C>
2121
where
22-
I: Iterator,
22+
I: Clone + Iterator,
23+
F: Clone,
2324
C: CountItem<I::Item>,
2425
C::CItem: Clone,
2526
{

src/free.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ where
166166
///
167167
/// assert_eq!(cloned(b"abc").next(), Some(b'a'));
168168
/// ```
169-
pub fn cloned<'a, I, T: 'a>(iterable: I) -> iter::Cloned<I::IntoIter>
169+
pub fn cloned<'a, I, T>(iterable: I) -> iter::Cloned<I::IntoIter>
170170
where
171171
I: IntoIterator<Item = &'a T>,
172-
T: Clone,
172+
T: Clone + 'a,
173173
{
174174
iterable.into_iter().cloned()
175175
}

src/groupbylazy.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ trait KeyFunction<A> {
77
fn call_mut(&mut self, arg: A) -> Self::Key;
88
}
99

10-
impl<A, K, F: ?Sized> KeyFunction<A> for F
10+
impl<A, K, F> KeyFunction<A> for F
1111
where
12-
F: FnMut(A) -> K,
12+
F: FnMut(A) -> K + ?Sized,
1313
{
1414
type Key = K;
1515
#[inline]
@@ -370,10 +370,12 @@ where
370370
///
371371
/// See [`.group_by()`](crate::Itertools::group_by) for more information.
372372
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
373-
pub struct Groups<'a, K: 'a, I: 'a, F: 'a>
373+
pub struct Groups<'a, K, I, F>
374374
where
375-
I: Iterator,
375+
I: Iterator + 'a,
376376
I::Item: 'a,
377+
K: 'a,
378+
F: 'a,
377379
{
378380
parent: &'a GroupBy<K, I, F>,
379381
}
@@ -409,10 +411,12 @@ where
409411
/// An iterator for the elements in a single group.
410412
///
411413
/// Iterator element type is `I::Item`.
412-
pub struct Group<'a, K: 'a, I: 'a, F: 'a>
414+
pub struct Group<'a, K, I, F>
413415
where
414-
I: Iterator,
416+
I: Iterator + 'a,
415417
I::Item: 'a,
418+
K: 'a,
419+
F: 'a,
416420
{
417421
parent: &'a GroupBy<K, I, F>,
418422
index: usize,
@@ -537,9 +541,9 @@ where
537541
/// See [`.chunks()`](crate::Itertools::chunks) for more information.
538542
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
539543
#[derive(Clone)]
540-
pub struct Chunks<'a, I: 'a>
544+
pub struct Chunks<'a, I>
541545
where
542-
I: Iterator,
546+
I: Iterator + 'a,
543547
I::Item: 'a,
544548
{
545549
parent: &'a IntoChunks<I>,
@@ -568,9 +572,9 @@ where
568572
/// An iterator for the elements in a single chunk.
569573
///
570574
/// Iterator element type is `I::Item`.
571-
pub struct Chunk<'a, I: 'a>
575+
pub struct Chunk<'a, I>
572576
where
573-
I: Iterator,
577+
I: Iterator + 'a,
574578
I::Item: 'a,
575579
{
576580
parent: &'a IntoChunks<I>,

src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2124,8 +2124,7 @@ pub trait Itertools: Iterator {
21242124
/// ```
21252125
fn dropping_back(mut self, n: usize) -> Self
21262126
where
2127-
Self: Sized,
2128-
Self: DoubleEndedIterator,
2127+
Self: Sized + DoubleEndedIterator,
21292128
{
21302129
if n > 0 {
21312130
(&mut self).rev().nth(n - 1);
@@ -3962,7 +3961,7 @@ pub trait Itertools: Iterator {
39623961
}
39633962
}
39643963

3965-
impl<T: ?Sized> Itertools for T where T: Iterator {}
3964+
impl<T> Itertools for T where T: Iterator + ?Sized {}
39663965

39673966
/// Return `true` if both iterables produce equal sequences
39683967
/// (elements pairwise equal and sequences of the same length),

src/peeking_take_while.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ where
9696
/// See [`.peeking_take_while()`](crate::Itertools::peeking_take_while)
9797
/// for more information.
9898
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
99-
pub struct PeekingTakeWhile<'a, I: 'a, F>
99+
pub struct PeekingTakeWhile<'a, I, F>
100100
where
101-
I: Iterator,
101+
I: Iterator + 'a,
102102
{
103103
iter: &'a mut I,
104104
f: F,
105105
}
106106

107-
impl<'a, I: 'a, F> std::fmt::Debug for PeekingTakeWhile<'a, I, F>
107+
impl<'a, I, F> std::fmt::Debug for PeekingTakeWhile<'a, I, F>
108108
where
109-
I: Iterator + std::fmt::Debug,
109+
I: Iterator + std::fmt::Debug + 'a,
110110
{
111111
debug_fmt_fields!(PeekingTakeWhile, iter);
112112
}

src/tuple_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ where
244244
/// information.
245245
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
246246
#[derive(Debug, Clone)]
247-
pub struct CircularTupleWindows<I, T: Clone>
247+
pub struct CircularTupleWindows<I, T>
248248
where
249249
I: Iterator<Item = T::Item> + Clone,
250250
T: TupleCollect + Clone,

src/ziptuple.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ pub struct Zip<T> {
3939
/// [`izip!()`]: crate::izip
4040
pub fn multizip<T, U>(t: U) -> Zip<T>
4141
where
42-
Zip<T>: From<U>,
43-
Zip<T>: Iterator,
42+
Zip<T>: From<U> + Iterator,
4443
{
4544
Zip::from(t)
4645
}

tests/test_std.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ fn test_rciter() {
364364
fn trait_pointers() {
365365
struct ByRef<'r, I: ?Sized>(&'r mut I);
366366

367-
impl<'r, X, I: ?Sized> Iterator for ByRef<'r, I>
367+
impl<'r, X, I> Iterator for ByRef<'r, I>
368368
where
369-
I: 'r + Iterator<Item = X>,
369+
I: ?Sized + 'r + Iterator<Item = X>,
370370
{
371371
type Item = X;
372372
fn next(&mut self) -> Option<Self::Item> {

0 commit comments

Comments
 (0)