2 ms·
I believe you can just use `.flatten()` instead of `.flat_map(|v| v)`: let mut output: Vec<_> = foo.stuff.into_iter() .flatten()
by coolreader18 6y ago
I believe you can just use `.flatten()` instead of `.flat_map(|v| v)`:
let mut output: Vec<_> =
foo.stuff.into_iter()
.flatten()
.chain(bar.stuff)
.collect();
I might make it slightly more clear what the intent is by doing this:
let mut output: Vec<_> =
Iterator::chain(foo.stuff.into_iter().flatten(), bar.stuff)
.collect();
But still basically the same.