Skip to content

Commit

Permalink
Resolve type_repetition_in_bounds clippy lint
Browse files Browse the repository at this point in the history
    error: this type has already been used as a bound predicate
       --> src/punctuated.rs:815:5
        |
    815 |     I: DoubleEndedIterator<Item = &'a T> + ExactSizeIterator<Item = &'a T> + Clone,
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
        = help: consider combining the bounds: `I: DoubleEndedIterator<Item = &'a T> + ExactSizeIterator<Item = &'a T> + 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<Item = &'a mut T> + ExactSizeIterator<Item = &'a mut T>
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `I: DoubleEndedIterator<Item = &'a mut T> + ExactSizeIterator<Item = &'a mut T>`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds
  • Loading branch information
dtolnay committed May 1, 2022
1 parent 3c07913 commit 9951445
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/punctuated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = &'a T> + ExactSizeIterator<Item = &'a T> + Clone,
T: 'a,
I: DoubleEndedIterator<Item = &'a T> + ExactSizeIterator<Item = &'a T> + Clone + 'a,
{
fn clone_box(&self) -> Box<dyn IterTrait<'a, T, Item = &'a T> + 'a> {
Box::new(self.clone())
Expand Down Expand Up @@ -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<Item = &'a mut T> + ExactSizeIterator<Item = &'a mut T>
impl<'a, T, I> IterMutTrait<'a, T> for I
where
T: 'a,
I: DoubleEndedIterator<Item = &'a mut T> + ExactSizeIterator<Item = &'a mut T> + 'a,
{
}

Expand Down

0 comments on commit 9951445

Please sign in to comment.