diff --git a/examples/moving_line/src/main.rs b/examples/moving_line/src/main.rs index b571054..9800c3b 100644 --- a/examples/moving_line/src/main.rs +++ b/examples/moving_line/src/main.rs @@ -19,8 +19,8 @@ fn main() { for x_offset in 0..usize::MAX { pixels.fill(false); - for y in 0..PIXEL_HEIGHT as usize { - pixels.set((y + x_offset) % PIXEL_WIDTH as usize, y, true); + for y in 0..PIXEL_HEIGHT { + pixels.set((y + x_offset) % PIXEL_WIDTH, y, true); } connection .send( diff --git a/examples/random_brightness/src/main.rs b/examples/random_brightness/src/main.rs index d44b086..d1f65ce 100644 --- a/examples/random_brightness/src/main.rs +++ b/examples/random_brightness/src/main.rs @@ -40,17 +40,17 @@ fn main() { // continuously update random windows to new random brightness loop { let min_size = 1; - let x: u16 = rng.gen_range(0..TILE_WIDTH - min_size); - let y: u16 = rng.gen_range(0..TILE_HEIGHT - min_size); + let x = rng.gen_range(0..TILE_WIDTH - min_size); + let y = rng.gen_range(0..TILE_HEIGHT - min_size); - let w: u16 = rng.gen_range(min_size..=TILE_WIDTH - x); - let h: u16 = rng.gen_range(min_size..=TILE_HEIGHT - y); + let w = rng.gen_range(min_size..=TILE_WIDTH - x); + let h = rng.gen_range(min_size..=TILE_HEIGHT - y); let origin = Origin(x, y); - let mut luma = ByteGrid::new(w as usize, h as usize); + let mut luma = ByteGrid::new(w, h); - for y in 0..h as usize { - for x in 0..w as usize { + for y in 0..h { + for x in 0..w { luma.set(x, y, rng.gen()); } } diff --git a/examples/wiping_clear/src/main.rs b/examples/wiping_clear/src/main.rs index 69dcd0d..74d6258 100644 --- a/examples/wiping_clear/src/main.rs +++ b/examples/wiping_clear/src/main.rs @@ -24,13 +24,12 @@ fn main() { let connection = Connection::open(cli.destination).unwrap(); - let mut enabled_pixels = - PixelGrid::new(PIXEL_WIDTH as usize, PIXEL_HEIGHT as usize); + let mut enabled_pixels = PixelGrid::new(PIXEL_WIDTH, PIXEL_HEIGHT); enabled_pixels.fill(true); - for x_offset in 0..PIXEL_WIDTH as usize { - for y in 0..PIXEL_HEIGHT as usize { - enabled_pixels.set(x_offset % PIXEL_WIDTH as usize, y, false); + for x_offset in 0..PIXEL_WIDTH { + for y in 0..PIXEL_HEIGHT { + enabled_pixels.set(x_offset % PIXEL_WIDTH, y, false); } // this works because the pixel grid has max size