Skip to content

Commit

Permalink
Auto merge of #110353 - the8472:in-place-flatten-chunks, r=cuviper
Browse files Browse the repository at this point in the history
Expand in-place iteration specialization to Flatten, FlatMap and ArrayChunks

This enables the following cases to collect in-place:

```rust
let v = vec![[0u8; 4]; 1024]
let v: Vec<_> = v.into_iter().flatten().collect();

let v: Vec<Option<NonZeroUsize>> = vec![NonZeroUsize::new(0); 1024];
let v: Vec<_> = v.into_iter().flatten().collect();

let v = vec![u8; 4096];
let v: Vec<_> = v.into_iter().array_chunks::<4>().collect();
```

Especially the nicheful-option-flattening should be useful in real code.
  • Loading branch information
bors committed Nov 28, 2023
2 parents 7b1b06d + c159e72 commit cf8a77b
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit cf8a77b

Please sign in to comment.