Skip to content

Commit

Permalink
Rust 1.84: Lint: Apply clippy::map_with_unused_argument_over_ranges.
Browse files Browse the repository at this point in the history
I’m not entirely sure I agree with this as general style,
but I like it in the specific cases here.
  • Loading branch information
kpreid committed Jan 9, 2025
1 parent d66c133 commit d123cb1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ large_futures = "warn"
large_stack_frames = "warn"
manual_let_else = "warn"
map_unwrap_or = "warn"
map_with_unused_argument_over_ranges = "warn"
missing_fields_in_debug = "warn"
module_name_repetitions = "warn"
modulo_arithmetic = "warn"
Expand Down
5 changes: 2 additions & 3 deletions all-is-cubes-gpu/src/in_wgpu/raytrace_to_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ impl Inner {
let render_viewport = self.render_viewport;

#[allow(clippy::needless_collect, reason = "needed with rayon and not without")]
let this_frame_pixels: Vec<Point> = (0..self.rays_per_frame)
.map(|_i| self.pixel_picker.next().unwrap())
.collect();
let this_frame_pixels: Vec<Point> =
(&mut self.pixel_picker).take(self.rays_per_frame).collect();

self.dirty_pixels = self.dirty_pixels.saturating_sub(this_frame_pixels.len());

Expand Down
1 change: 1 addition & 0 deletions all-is-cubes-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ large_futures = "warn"
large_stack_frames = "warn"
manual_let_else = "warn"
map_unwrap_or = "warn"
map_with_unused_argument_over_ranges = "warn"
missing_fields_in_debug = "warn"
module_name_repetitions = "warn"
modulo_arithmetic = "warn"
Expand Down
7 changes: 4 additions & 3 deletions all-is-cubes/src/block/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,10 @@ fn overflow_evaluate() {
let too_many_modifiers: u32 = block::Budget::default().components;

let mut block = AIR;
block
.modifiers_mut()
.extend((0..too_many_modifiers).map(|_| Modifier::Rotate(GridRotation::CLOCKWISE)));
block.modifiers_mut().extend(std::iter::repeat_n(
Modifier::Rotate(GridRotation::CLOCKWISE),
too_many_modifiers as usize,
));
assert_eq!(
block.evaluate(),
Err(EvalBlockError {
Expand Down
4 changes: 2 additions & 2 deletions all-is-cubes/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ mod tests {
fn clock_phase_advance() {
let mut clock = Clock::new(TickSchedule::per_second(3), 0);
assert_eq!(
(0..10)
.map(|_| clock.advance(false).prev_phase())
std::iter::repeat_with(|| clock.advance(false).prev_phase())
.take(10)
.collect::<Vec<_>>(),
vec![0, 1, 2, 0, 1, 2, 0, 1, 2, 0],
);
Expand Down

0 comments on commit d123cb1

Please sign in to comment.