File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1331,15 +1331,15 @@ where
1331
1331
if self . is_standard_layout ( ) {
1332
1332
CowArray :: from ( self . view ( ) )
1333
1333
} else {
1334
- let v: Vec < A > = self . iter ( ) . cloned ( ) . collect ( ) ;
1334
+ let v = crate :: iterators :: to_vec_mapped ( self . iter ( ) , A :: clone ) ;
1335
1335
let dim = self . dim . clone ( ) ;
1336
- assert_eq ! ( v. len( ) , dim. size( ) ) ;
1337
- let owned_array: Array < A , D > = unsafe {
1336
+ debug_assert_eq ! ( v. len( ) , dim. size( ) ) ;
1337
+
1338
+ unsafe {
1338
1339
// Safe because the shape and element type are from the existing array
1339
1340
// and the strides are the default strides.
1340
- Array :: from_shape_vec_unchecked ( dim, v)
1341
- } ;
1342
- CowArray :: from ( owned_array)
1341
+ CowArray :: from ( Array :: from_shape_vec_unchecked ( dim, v) )
1342
+ }
1343
1343
}
1344
1344
}
1345
1345
You can’t perform that action at this time.
0 commit comments