Open
Description
There are a few places where we construct a fixed size array of objects, then run that through map()
in order to produce another fixed size array. For example:
let bit_ctx: [_; 3] = top_ctx
.iter()
.map(|ctx| ctx.narrow(&format!("bit{}", bit)))
.collect::<Vec<_>>()
.try_into()
.unwrap();
This is super awkward as you have to iterate the slice, map, collect into a Vec<_>
, then use try_into()
to maybe create the array, then unwrap that. This would be cleaner, once each_ref()
becomes available in mainline rust.
let bit_ctx = top_ctx.each_ref().map(|ctx| ctx.refine(format!("bit{}", bit)));
Metadata
Metadata
Assignees
Labels
No labels