Skip to content

Commit

Permalink
relax bounds on iterator adapter Default impls
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Feb 28, 2023
1 parent a4bdfe2 commit e44836f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 25 deletions.
6 changes: 1 addition & 5 deletions library/core/src/iter/adapters/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,7 @@ where
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
impl<A, B> Default for Chain<A, B>
where
A: Iterator + Default,
B: Iterator + Default,
{
impl<A: Default, B: Default> Default for Chain<A, B> {
/// Creates a `Chain` from the default values for `A` and `B`.
///
/// ```
Expand Down
6 changes: 1 addition & 5 deletions library/core/src/iter/adapters/cloned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ where
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
impl<'a, I, T: 'a> Default for Cloned<I>
where
I: Default + Iterator<Item = &'a T>,
T: Clone,
{
impl<I: Default> Default for Cloned<I> {
/// Creates a `Cloned` iterator from the default value of `I`
/// ```
/// # use core::slice;
Expand Down
6 changes: 1 addition & 5 deletions library/core/src/iter/adapters/copied.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,7 @@ where
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
impl<'a, I, T: 'a> Default for Copied<I>
where
I: Default + Iterator<Item = &'a T>,
T: Copy,
{
impl<I: Default> Default for Copied<I> {
/// Creates a `Copied` iterator from the default value of `I`
/// ```
/// # use core::slice;
Expand Down
5 changes: 1 addition & 4 deletions library/core/src/iter/adapters/enumerate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,7 @@ where
unsafe impl<I: InPlaceIterable> InPlaceIterable for Enumerate<I> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
impl<I> Default for Enumerate<I>
where
I: Iterator + Default,
{
impl<I: Default> Default for Enumerate<I> {
/// Creates an `Enumerate` iterator from the default value of `I`
/// ```
/// # use core::slice;
Expand Down
3 changes: 1 addition & 2 deletions library/core/src/iter/adapters/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ where
#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
impl<I> Default for Flatten<I>
where
I: Iterator + Default,
<I as Iterator>::Item: IntoIterator,
I: Default + Iterator<Item: IntoIterator>,
{
/// Creates a `Flatten` iterator from the default value of `I`.
///
Expand Down
5 changes: 1 addition & 4 deletions library/core/src/iter/adapters/rev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ impl<I> FusedIterator for Rev<I> where I: FusedIterator + DoubleEndedIterator {}
unsafe impl<I> TrustedLen for Rev<I> where I: TrustedLen + DoubleEndedIterator {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
impl<I> Default for Rev<I>
where
I: Default + Iterator,
{
impl<I: Default> Default for Rev<I> {
/// Creates a `Rev` iterator from the default value of `I`
/// ```
/// # use core::slice;
Expand Down

0 comments on commit e44836f

Please sign in to comment.