File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -533,11 +533,14 @@ unsafe fn collect_into_array_unchecked<I, const N: usize>(iter: &mut I) -> [I::I
533
533
where
534
534
I : Iterator + TrustedLen ,
535
535
{
536
- let mut map = iter. map ( |el| Ok :: < _ , Infallible > ( el ) ) ;
536
+ let mut map = iter. map ( Ok :: < _ , Infallible > ) ;
537
537
538
- // SAFETY: Valid array elements are covered by the fact that all passed values
539
- // to `collect_into_array` are `Ok`.
540
- unsafe { collect_into_array_rslt_unchecked ( & mut map) . unwrap_unchecked ( ) }
538
+ // SAFETY: The same safety considerations w.r.t. the iterator length
539
+ // apply for `collect_into_array_rslt_unchecked` as for
540
+ // `collect_into_array_unchecked`
541
+ match unsafe { collect_into_array_rslt_unchecked ( & mut map) } {
542
+ Ok ( array) => array,
543
+ }
541
544
}
542
545
543
546
/// Pulls `N` items from `iter` and returns them as an array. If the iterator
You can’t perform that action at this time.
0 commit comments