diff --git a/src/hud/hotbar_hud.rs b/src/hud/hotbar_hud.rs index 8810d71..1183bf1 100644 --- a/src/hud/hotbar_hud.rs +++ b/src/hud/hotbar_hud.rs @@ -80,7 +80,7 @@ impl HotbarHud { let color_front = color.mul_element_wise(Vector4::new(0.15, 0.15, 0.15, 1.0)).into(); let color_top = color.into(); - vertices.extend(&[ + vertices.extend([ // Left face HudVertex { position: [UI_SCALE_X * (x + 12.0), -1.0 + UI_SCALE_Y * 3.5], @@ -161,7 +161,7 @@ impl HotbarHud { ]); #[rustfmt::skip] - indices.extend(&[ + indices.extend([ // Left face 2 + index_offset, index_offset, 1 + index_offset, 3 + index_offset, index_offset, 2 + index_offset, diff --git a/src/view.rs b/src/view.rs index ba8d2b8..457af81 100644 --- a/src/view.rs +++ b/src/view.rs @@ -108,7 +108,7 @@ impl View { let projection = OPENGL_TO_WGPU_MATRIX.invert().unwrap() * self.projection_matrix; let inverse_matrix = projection.invert().unwrap(); - let corners = &[ + let corners = [ Vector4::new(-1.0, -1.0, 1.0, 1.0), Vector4::new(-1.0, -1.0, -1.0, 1.0), Vector4::new(-1.0, 1.0, 1.0, 1.0), @@ -121,7 +121,7 @@ impl View { let mut min = Vector4::new(f32::INFINITY, f32::INFINITY, f32::INFINITY, 1.0); let mut max = Vector4::new(0.0, 0.0, 0.0, 1.0); - for &corner in corners { + for corner in corners { let corner = inverse_matrix * corner; let corner = corner / corner.w; diff --git a/src/world/mod.rs b/src/world/mod.rs index a4bee08..89f4671 100644 --- a/src/world/mod.rs +++ b/src/world/mod.rs @@ -100,7 +100,7 @@ impl World { // Unload chunks that are far away self.unload_timer += dt; if self.unload_timer.as_secs() >= 10 { - self.unload_timer = Duration::new(0, 0); + self.unload_timer = Duration::ZERO; let camera_pos = camera.position.to_vec(); let unload_distance = (RENDER_DISTANCE * CHUNK_ISIZE) as f32 * 1.5; @@ -358,7 +358,7 @@ impl World { highlighted: None, - unload_timer: Duration::new(0, 0), + unload_timer: Duration::ZERO, } } @@ -391,7 +391,7 @@ impl World { if let Some(chunk) = self.chunks.get(&position) { render_queue.push(position); if !chunk.full { - queue.extend(&[ + queue.extend([ position + Vector3::unit_x(), position - Vector3::unit_x(), position + Vector3::unit_y(), diff --git a/src/world/quad.rs b/src/world/quad.rs index 6d71c94..504d7e4 100644 --- a/src/world/quad.rs +++ b/src/world/quad.rs @@ -72,13 +72,13 @@ impl Quad { let normal = Vector3::new(-1, 0, 0); let highlighted = (self.highlighted_normal == normal) as i32; let normal = normal.cast().unwrap().into(); - vertices.extend(&[ + vertices.extend([ BlockVertex { position: [x, y, z ], texture_coordinates: [dz, 1.0], texture_id: t.0 as i32, normal, highlighted, color }, BlockVertex { position: [x, y, z + dz], texture_coordinates: [0.0, 1.0], texture_id: t.0 as i32, normal, highlighted, color }, BlockVertex { position: [x, y + dy, z + dz], texture_coordinates: [0.0, 0.0], texture_id: t.0 as i32, normal, highlighted, color }, BlockVertex { position: [x, y + dy, z ], texture_coordinates: [dz, 0.0], texture_id: t.0 as i32, normal, highlighted, color }, ]); - indices.extend(&[ + indices.extend([ 2 + current_index, current_index, 1 + current_index, 3 + current_index, current_index, 2 + current_index, ]); @@ -89,13 +89,13 @@ impl Quad { let normal = Vector3::new(1, 0, 0); let highlighted = (self.highlighted_normal == normal) as i32; let normal = normal.cast().unwrap().into(); - vertices.extend(&[ + vertices.extend([ BlockVertex { position: [x + dx, y, z ], texture_coordinates: [0.0, 1.0], texture_id: t.1 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y, z + dz], texture_coordinates: [dz, 1.0], texture_id: t.1 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y + dy, z + dz], texture_coordinates: [dz, 0.0], texture_id: t.1 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y + dy, z ], texture_coordinates: [0.0, 0.0], texture_id: t.1 as i32, normal, highlighted, color }, ]); - indices.extend(&[ + indices.extend([ 1 + current_index, current_index, 2 + current_index, 2 + current_index, current_index, 3 + current_index, ]); @@ -106,13 +106,13 @@ impl Quad { let normal = Vector3::new(0, 0, -1); let highlighted = (self.highlighted_normal == normal) as i32; let normal = normal.cast().unwrap().into(); - vertices.extend(&[ + vertices.extend([ BlockVertex { position: [x, y, z], texture_coordinates: [dx, 1.0], texture_id: t.2 as i32, normal, highlighted, color }, BlockVertex { position: [x, y + dy, z], texture_coordinates: [dx, 0.0], texture_id: t.2 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y + dy, z], texture_coordinates: [0.0, 0.0], texture_id: t.2 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y, z], texture_coordinates: [0.0, 1.0], texture_id: t.2 as i32, normal, highlighted, color }, ]); - indices.extend(&[ + indices.extend([ 2 + current_index, current_index, 1 + current_index, 3 + current_index, current_index, 2 + current_index, ]); @@ -123,13 +123,13 @@ impl Quad { let normal = Vector3::new(0, 0, 1); let highlighted = (self.highlighted_normal == normal) as i32; let normal = normal.cast().unwrap().into(); - vertices.extend(&[ + vertices.extend([ BlockVertex { position: [x, y, z + dz], texture_coordinates: [0.0, 1.0], texture_id: t.3 as i32, normal, highlighted, color }, BlockVertex { position: [x, y + dy, z + dz], texture_coordinates: [0.0, 0.0], texture_id: t.3 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y + dy, z + dz], texture_coordinates: [dx, 0.0], texture_id: t.3 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y, z + dz], texture_coordinates: [dx, 1.0], texture_id: t.3 as i32, normal, highlighted, color }, ]); - indices.extend(&[ + indices.extend([ 1 + current_index, current_index, 2 + current_index, 2 + current_index, current_index, 3 + current_index, ]); @@ -140,13 +140,13 @@ impl Quad { let normal = Vector3::new(0, -1, 0); let highlighted = (self.highlighted_normal == normal) as i32; let normal = normal.cast().unwrap().into(); - vertices.extend(&[ + vertices.extend([ BlockVertex { position: [x, y, z ], texture_coordinates: [dx, 0.0], texture_id: t.4 as i32, normal, highlighted, color }, BlockVertex { position: [x, y, z + dz], texture_coordinates: [dx, dz ], texture_id: t.4 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y, z + dz], texture_coordinates: [0.0, dz ], texture_id: t.4 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y, z ], texture_coordinates: [0.0, 0.0], texture_id: t.4 as i32, normal, highlighted, color }, ]); - indices.extend(&[ + indices.extend([ current_index, 2 + current_index, 1 + current_index, current_index, 3 + current_index, 2 + current_index, ]); @@ -157,13 +157,13 @@ impl Quad { let normal = Vector3::new(0, 1, 0); let highlighted = (self.highlighted_normal == normal) as i32; let normal = normal.cast().unwrap().into(); - vertices.extend(&[ + vertices.extend([ BlockVertex { position: [x, y + dy, z ], texture_coordinates: [0.0, 0.0], texture_id: t.5 as i32, normal, highlighted, color }, BlockVertex { position: [x, y + dy, z + dz], texture_coordinates: [0.0, dz ], texture_id: t.5 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y + dy, z + dz], texture_coordinates: [dx, dz ], texture_id: t.5 as i32, normal, highlighted, color }, BlockVertex { position: [x + dx, y + dy, z ], texture_coordinates: [dx, 0.0], texture_id: t.5 as i32, normal, highlighted, color }, ]); - indices.extend(&[ + indices.extend([ current_index, 1 + current_index, 2 + current_index, current_index, 2 + current_index, 3 + current_index, ]);