Skip to content

Commit 0c20df4

Browse files
committed
fix clippy::type_repetition_in_bounds
1 parent 4d1d2b3 commit 0c20df4

File tree

7 files changed

+30
-25
lines changed

7 files changed

+30
-25
lines changed

src/adaptors/coalesce.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ where
1313
f: F,
1414
}
1515

16-
impl<I: Clone, F: Clone, T: Clone> Clone for CoalesceBy<I, F, T>
16+
impl<I, F, T> Clone for CoalesceBy<I, F, T>
1717
where
18-
I: Iterator,
18+
I: Clone + Iterator,
19+
F: Clone,
20+
T: Clone,
1921
{
2022
clone_fields!(last, iter, f);
2123
}

src/free.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ pub fn chain<I, J>(i: I, j: J) -> iter::Chain<<I as IntoIterator>::IntoIter, <J
151151
///
152152
/// assert_eq!(cloned(b"abc").next(), Some(b'a'));
153153
/// ```
154-
pub fn cloned<'a, I, T: 'a>(iterable: I) -> iter::Cloned<I::IntoIter>
154+
pub fn cloned<'a, I, T>(iterable: I) -> iter::Cloned<I::IntoIter>
155155
where I: IntoIterator<Item=&'a T>,
156-
T: Clone,
156+
T: Clone + 'a,
157157
{
158158
iterable.into_iter().cloned()
159159
}

src/groupbylazy.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ 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
11-
where F: FnMut(A) -> K
10+
impl<A, K, F> KeyFunction<A> for F
11+
where F: FnMut(A) -> K + ?Sized
1212
{
1313
type Key = K;
1414
#[inline]
@@ -356,9 +356,12 @@ impl<'a, K, I, F> IntoIterator for &'a GroupBy<K, I, F>
356356
///
357357
/// See [`.group_by()`](crate::Itertools::group_by) for more information.
358358
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
359-
pub struct Groups<'a, K: 'a, I: 'a, F: 'a>
360-
where I: Iterator,
361-
I::Item: 'a
359+
pub struct Groups<'a, K, I, F>
360+
where I: Iterator + 'a,
361+
I::Item: 'a,
362+
K: 'a,
363+
F: 'a,
364+
362365
{
363366
parent: &'a GroupBy<K, I, F>,
364367
}
@@ -390,9 +393,11 @@ impl<'a, K, I, F> Iterator for Groups<'a, K, I, F>
390393
/// An iterator for the elements in a single group.
391394
///
392395
/// Iterator element type is `I::Item`.
393-
pub struct Group<'a, K: 'a, I: 'a, F: 'a>
394-
where I: Iterator,
396+
pub struct Group<'a, K, I, F>
397+
where I: Iterator + 'a,
395398
I::Item: 'a,
399+
K: 'a,
400+
F: 'a,
396401
{
397402
parent: &'a GroupBy<K, I, F>,
398403
index: usize,
@@ -507,8 +512,8 @@ impl<'a, I> IntoIterator for &'a IntoChunks<I>
507512
///
508513
/// See [`.chunks()`](crate::Itertools::chunks) for more information.
509514
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
510-
pub struct Chunks<'a, I: 'a>
511-
where I: Iterator,
515+
pub struct Chunks<'a, I>
516+
where I: Iterator + 'a,
512517
I::Item: 'a,
513518
{
514519
parent: &'a IntoChunks<I>,
@@ -538,8 +543,8 @@ impl<'a, I> Iterator for Chunks<'a, I>
538543
/// An iterator for the elements in a single chunk.
539544
///
540545
/// Iterator element type is `I::Item`.
541-
pub struct Chunk<'a, I: 'a>
542-
where I: Iterator,
546+
pub struct Chunk<'a, I>
547+
where I: Iterator + 'a,
543548
I::Item: 'a,
544549
{
545550
parent: &'a IntoChunks<I>,

src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,8 +1917,7 @@ pub trait Itertools : Iterator {
19171917
/// itertools::assert_equal(init, vec![0, 3, 6]);
19181918
/// ```
19191919
fn dropping_back(mut self, n: usize) -> Self
1920-
where Self: Sized,
1921-
Self: DoubleEndedIterator
1920+
where Self: Sized + DoubleEndedIterator,
19221921
{
19231922
if n > 0 {
19241923
(&mut self).rev().nth(n - 1);
@@ -3654,7 +3653,7 @@ pub trait Itertools : Iterator {
36543653
}
36553654
}
36563655

3657-
impl<T: ?Sized> Itertools for T where T: Iterator { }
3656+
impl<T> Itertools for T where T: Iterator + ?Sized { }
36583657

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

src/peeking_take_while.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ impl<I> PeekingNext for PutBackN<I>
7676
/// See [`.peeking_take_while()`](crate::Itertools::peeking_take_while)
7777
/// for more information.
7878
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
79-
pub struct PeekingTakeWhile<'a, I: 'a, F>
80-
where I: Iterator,
79+
pub struct PeekingTakeWhile<'a, I, F>
80+
where I: Iterator + 'a,
8181
{
8282
iter: &'a mut I,
8383
f: F,
8484
}
8585

86-
impl<'a, I: 'a, F> std::fmt::Debug for PeekingTakeWhile<'a, I, F>
86+
impl<'a, I, F> std::fmt::Debug for PeekingTakeWhile<'a, I, F>
8787
where
88-
I: Iterator + std::fmt::Debug,
88+
I: Iterator + std::fmt::Debug + 'a,
8989
{
9090
debug_fmt_fields!(PeekingTakeWhile, iter);
9191
}

src/tuple_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<I, T> FusedIterator for TupleWindows<I, T>
203203
/// information.
204204
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
205205
#[derive(Debug)]
206-
pub struct CircularTupleWindows<I, T: Clone>
206+
pub struct CircularTupleWindows<I, T>
207207
where I: Iterator<Item = T::Item> + Clone,
208208
T: TupleCollect + Clone
209209
{

src/ziptuple.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ pub struct Zip<T> {
3838
/// ```
3939
/// [`izip!()`]: crate::izip
4040
pub fn multizip<T, U>(t: U) -> Zip<T>
41-
where Zip<T>: From<U>,
42-
Zip<T>: Iterator,
41+
where Zip<T>: From<U> + Iterator,
4342
{
4443
Zip::from(t)
4544
}

0 commit comments

Comments
 (0)