Skip to content

Commit

Permalink
Rust 1.82: Use iter::repeat_n().
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Oct 17, 2024
1 parent d2a4ff9 commit 660d369
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions all-is-cubes-mesh/src/block_mesh/viz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,14 @@ impl Viz {
state
.mesh_vertex_positions
.extend(vertex_positions.iter().copied());
state.mesh_vertex_colors.extend(
iter::repeat(rg::components::Color(color_fn().into())).take(vertex_positions.len()),
);
state.mesh_vertex_normals.extend(
iter::repeat(rg::components::Vector3D(rg::convert_vec(
normal.normal_vector::<f32, ()>(),
)))
.take(vertex_positions.len()),
);
state.mesh_vertex_colors.extend(iter::repeat_n(
rg::components::Color(color_fn().into()),
vertex_positions.len(),
));
state.mesh_vertex_normals.extend(iter::repeat_n(
rg::components::Vector3D(rg::convert_vec(normal.normal_vector::<f32, ()>())),
vertex_positions.len(),
));
state.mesh_triangle_indices.extend(
relative_indices_iter
.clone()
Expand Down
2 changes: 1 addition & 1 deletion all-is-cubes/src/block/eval/evaluated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ impl EvaluatedBlock {
let inventory = inv::Inventory::from_slots(
itertools::Itertools::zip_longest(
contents,
core::iter::repeat(inv::Slot::Empty).take(config.size),
core::iter::repeat_n(inv::Slot::Empty, config.size),
)
.map(|z| z.into_left())
.collect::<Box<[inv::Slot]>>(),
Expand Down

0 comments on commit 660d369

Please sign in to comment.