From 995144555b0410b0fd131e4fb0684fc6a71ec298 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 30 Apr 2022 20:42:32 -0700 Subject: [PATCH] Resolve type_repetition_in_bounds clippy lint error: this type has already been used as a bound predicate --> src/punctuated.rs:815:5 | 815 | I: DoubleEndedIterator + ExactSizeIterator + Clone, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic` = help: consider combining the bounds: `I: DoubleEndedIterator + ExactSizeIterator + Clone` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds error: this type has already been used as a bound predicate --> src/punctuated.rs:898:5 | 898 | I: DoubleEndedIterator + ExactSizeIterator | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider combining the bounds: `I: DoubleEndedIterator + ExactSizeIterator` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds --- src/punctuated.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/punctuated.rs b/src/punctuated.rs index 5e9a34bdf7..6525bfa935 100644 --- a/src/punctuated.rs +++ b/src/punctuated.rs @@ -810,9 +810,10 @@ impl<'a, T, P> Clone for PrivateIter<'a, T, P> { } } -impl<'a, T: 'a, I: 'a> IterTrait<'a, T> for I +impl<'a, T, I> IterTrait<'a, T> for I where - I: DoubleEndedIterator + ExactSizeIterator + Clone, + T: 'a, + I: DoubleEndedIterator + ExactSizeIterator + Clone + 'a, { fn clone_box(&self) -> Box + 'a> { Box::new(self.clone()) @@ -894,8 +895,10 @@ impl<'a, T, P> ExactSizeIterator for PrivateIterMut<'a, T, P> { } } -impl<'a, T: 'a, I: 'a> IterMutTrait<'a, T> for I where - I: DoubleEndedIterator + ExactSizeIterator +impl<'a, T, I> IterMutTrait<'a, T> for I +where + T: 'a, + I: DoubleEndedIterator + ExactSizeIterator + 'a, { }