Skip to content

Commit

Permalink
Use std::Vec::retain instead of awkward do-while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tanuva committed Nov 13, 2023
1 parent 9b9c408 commit af6ed4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/effects/pixelflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ impl PixelFlow {
}

fn remove_pulses(&mut self) {
// TODO Try self.pulses.retain(|pulse| pulse.position < self.pixel_count as f32 - 1.0);
// FIXME This is not flow direction agnostic!
// This would be nicer as a do-while loop. And feels awkward in any case.
self.pulses
.retain(|pulse| pulse.position < self.pixel_count as f32 - 1.0);
return;

let mut check_again = true;
while check_again {
check_again = false;
Expand Down

0 comments on commit af6ed4d

Please sign in to comment.