11//! Defines the `IntoIter` owned iterator for arrays.
22
3- use super :: LengthAtMost32 ;
43use crate :: {
54 fmt,
65 iter:: { ExactSizeIterator , FusedIterator , TrustedLen } ,
@@ -13,10 +12,7 @@ use crate::{
1312///
1413/// [array]: ../../std/primitive.array.html
1514#[ unstable( feature = "array_value_iter" , issue = "65798" ) ]
16- pub struct IntoIter < T , const N : usize >
17- where
18- [ T ; N ] : LengthAtMost32 ,
19- {
15+ pub struct IntoIter < T , const N : usize > {
2016 /// This is the array we are iterating over.
2117 ///
2218 /// Elements with index `i` where `alive.start <= i < alive.end` have not
3935 alive : Range < usize > ,
4036}
4137
42- impl < T , const N : usize > IntoIter < T , N >
43- where
44- [ T ; N ] : LengthAtMost32 ,
45- {
38+ impl < T , const N : usize > IntoIter < T , N > {
4639 /// Creates a new iterator over the given `array`.
4740 ///
4841 /// *Note*: this method might never get stabilized and/or removed in the
9992}
10093
10194#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
102- impl < T , const N : usize > Iterator for IntoIter < T , N >
103- where
104- [ T ; N ] : LengthAtMost32 ,
105- {
95+ impl < T , const N : usize > Iterator for IntoIter < T , N > {
10696 type Item = T ;
10797 fn next ( & mut self ) -> Option < Self :: Item > {
10898 if self . alive . start == self . alive . end {
@@ -146,10 +136,7 @@ where
146136}
147137
148138#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
149- impl < T , const N : usize > DoubleEndedIterator for IntoIter < T , N >
150- where
151- [ T ; N ] : LengthAtMost32 ,
152- {
139+ impl < T , const N : usize > DoubleEndedIterator for IntoIter < T , N > {
153140 fn next_back ( & mut self ) -> Option < Self :: Item > {
154141 if self . alive . start == self . alive . end {
155142 return None ;
@@ -182,10 +169,7 @@ where
182169}
183170
184171#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
185- impl < T , const N : usize > Drop for IntoIter < T , N >
186- where
187- [ T ; N ] : LengthAtMost32 ,
188- {
172+ impl < T , const N : usize > Drop for IntoIter < T , N > {
189173 fn drop ( & mut self ) {
190174 // SAFETY: This is safe: `as_mut_slice` returns exactly the sub-slice
191175 // of elements that have not been moved out yet and that remain
@@ -195,10 +179,7 @@ where
195179}
196180
197181#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
198- impl < T , const N : usize > ExactSizeIterator for IntoIter < T , N >
199- where
200- [ T ; N ] : LengthAtMost32 ,
201- {
182+ impl < T , const N : usize > ExactSizeIterator for IntoIter < T , N > {
202183 fn len ( & self ) -> usize {
203184 // Will never underflow due to the invariant `alive.start <=
204185 // alive.end`.
@@ -210,20 +191,17 @@ where
210191}
211192
212193#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
213- impl < T , const N : usize > FusedIterator for IntoIter < T , N > where [ T ; N ] : LengthAtMost32 { }
194+ impl < T , const N : usize > FusedIterator for IntoIter < T , N > { }
214195
215196// The iterator indeed reports the correct length. The number of "alive"
216197// elements (that will still be yielded) is the length of the range `alive`.
217198// This range is decremented in length in either `next` or `next_back`. It is
218199// always decremented by 1 in those methods, but only if `Some(_)` is returned.
219200#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
220- unsafe impl < T , const N : usize > TrustedLen for IntoIter < T , N > where [ T ; N ] : LengthAtMost32 { }
201+ unsafe impl < T , const N : usize > TrustedLen for IntoIter < T , N > { }
221202
222203#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
223- impl < T : Clone , const N : usize > Clone for IntoIter < T , N >
224- where
225- [ T ; N ] : LengthAtMost32 ,
226- {
204+ impl < T : Clone , const N : usize > Clone for IntoIter < T , N > {
227205 fn clone ( & self ) -> Self {
228206 // SAFETY: each point of unsafety is documented inside the unsafe block
229207 unsafe {
@@ -249,10 +227,7 @@ where
249227}
250228
251229#[ stable( feature = "array_value_iter_impls" , since = "1.40.0" ) ]
252- impl < T : fmt:: Debug , const N : usize > fmt:: Debug for IntoIter < T , N >
253- where
254- [ T ; N ] : LengthAtMost32 ,
255- {
230+ impl < T : fmt:: Debug , const N : usize > fmt:: Debug for IntoIter < T , N > {
256231 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
257232 // Only print the elements that were not yielded yet: we cannot
258233 // access the yielded elements anymore.
0 commit comments