diff --git a/crates/client/src/camera.rs b/crates/client/src/camera.rs index 1c30224..1aee458 100644 --- a/crates/client/src/camera.rs +++ b/crates/client/src/camera.rs @@ -61,7 +61,7 @@ impl Camera { /// Advances the camera by a single frame, applying `input` accumulated over `dt` seconds. pub fn update(&mut self, input: &InputState, dt: f32) { // Apply accumulated mouse motion to the orientation. A downward mouse delta (positive y) lowers the pitch, so the vertical term is subtracted. - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] { self.yaw += input.mouse_delta.0 as f32 * self.sensitivity; self.pitch -= input.mouse_delta.1 as f32 * self.sensitivity; diff --git a/crates/client/src/main.rs b/crates/client/src/main.rs index 8347645..6846350 100644 --- a/crates/client/src/main.rs +++ b/crates/client/src/main.rs @@ -25,7 +25,7 @@ use winit::window::{CursorGrabMode, Window, WindowId}; /// Keyboard fields hold whether a movement key is currently pressed. `mouse_delta` accumulates /// raw pointer motion between frames and is consumed (reset to zero) once applied to the camera. // The bools are independent per-key held states, for which a flat struct is the clearest form. -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] #[derive(Default)] struct InputState { /// Whether the "move forward" key (W) is held. @@ -143,10 +143,10 @@ impl ApplicationHandler for App { self.window = Some(window); self.renderer = Some(renderer); - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let config_str = std::fs::read_to_string("assets/data/worldgen/default.json") .expect("Failed to read worldgen config"); - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let worldgen_config: shared::generator::WorldGenConfig = serde_json::from_str(&config_str).expect("Failed to parse worldgen config"); @@ -162,7 +162,7 @@ impl ApplicationHandler for App { indices.len() ); - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] self.renderer .as_mut() .expect("Renderer initialized") diff --git a/crates/client/src/meshing.rs b/crates/client/src/meshing.rs index c8dde11..4e40355 100644 --- a/crates/client/src/meshing.rs +++ b/crates/client/src/meshing.rs @@ -3,7 +3,7 @@ use renderer::mesh::Vertex; use shared::world::{BlockId, CHUNK_SIZE, Chunk}; -#[allow( +#[expect( clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::too_many_lines diff --git a/crates/renderer/src/device.rs b/crates/renderer/src/device.rs index 045098c..84fb199 100644 --- a/crates/renderer/src/device.rs +++ b/crates/renderer/src/device.rs @@ -67,7 +67,7 @@ pub fn find_graphics_queue_family( let props = unsafe { instance.get_physical_device_queue_family_properties(physical_device) }; for (index, prop) in props.iter().enumerate() { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let index = u32::try_from(index).expect("Queue family index exceeds u32 range"); let graphics = prop.queue_flags.contains(vk::QueueFlags::GRAPHICS); let present = unsafe { diff --git a/crates/renderer/src/lib.rs b/crates/renderer/src/lib.rs index fe60fb0..7f21a07 100644 --- a/crates/renderer/src/lib.rs +++ b/crates/renderer/src/lib.rs @@ -40,7 +40,6 @@ impl Renderer { /// /// Panics if `MAX_FRAMES_IN_FLIGHT` or vertex data sizes exceed `u32`/`u64` limits. // TODO: partial-construction leak. Each `?` below early-returns and leaks every Vulkan resource created so far; only a fully successful `new` reaches `Drop for Renderer`. Once the renderer grows more state, wrap each resource in an RAII guard so failure paths tear them down too. - #[allow(clippy::expect_used)] pub fn new( display_handle: RawDisplayHandle, window_handle: RawWindowHandle, @@ -97,7 +96,7 @@ impl Renderer { let command_pool = unsafe { device.create_command_pool(&pool_create_info, None)? }; // 9. Command Buffers - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let alloc_info = vk::CommandBufferAllocateInfo::default() .command_pool(command_pool) .level(vk::CommandBufferLevel::PRIMARY) diff --git a/crates/renderer/src/mesh.rs b/crates/renderer/src/mesh.rs index 67f7e90..048f7b8 100644 --- a/crates/renderer/src/mesh.rs +++ b/crates/renderer/src/mesh.rs @@ -24,7 +24,7 @@ impl Vertex { /// /// # Panics /// Panics if the size of the vertex structure exceeds the maximum value of a 32-bit unsigned integer. - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] pub fn get_binding_description() -> ash::vk::VertexInputBindingDescription { ash::vk::VertexInputBindingDescription::default() .binding(0) @@ -37,7 +37,6 @@ impl Vertex { /// Describes the layout of individual fields (attributes) within a single vertex. /// /// These 'locations' must match the `layout(location = X)` qualifiers in the vertex shader. - #[allow(clippy::expect_used)] pub fn get_attribute_descriptions() -> [ash::vk::VertexInputAttributeDescription; 2] { [ // Location 0: position (vec3 -> R32G32B32_SFLOAT) diff --git a/crates/renderer/src/pipeline.rs b/crates/renderer/src/pipeline.rs index 5d968d8..dbfa789 100644 --- a/crates/renderer/src/pipeline.rs +++ b/crates/renderer/src/pipeline.rs @@ -29,7 +29,7 @@ pub fn create_shader_module( /// This layout defines any push constants or descriptor sets (textures/UBOs) accessed by the shaders during execution. pub fn create_pipeline_layout(device: &Device) -> Result { // A single push constant range is defined for the MVP matrix, allowing it to be updated for every draw call with high efficiency. - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let push_constant_range = vk::PushConstantRange::default() .stage_flags(vk::ShaderStageFlags::VERTEX) .offset(0) diff --git a/crates/renderer/src/renderer.rs b/crates/renderer/src/renderer.rs index 80b3275..d12d320 100644 --- a/crates/renderer/src/renderer.rs +++ b/crates/renderer/src/renderer.rs @@ -17,14 +17,14 @@ pub struct Renderer { /// The debug messenger for validation layer output. pub(crate) debug_messenger: vk::DebugUtilsMessengerEXT, /// Handle to the selected physical device (GPU). - #[allow(dead_code)] + #[expect(dead_code)] pub(crate) physical_device: vk::PhysicalDevice, /// The logical Vulkan device. pub(crate) device: Device, /// The queue used for graphics operations. pub(crate) graphics_queue: vk::Queue, /// Index of the graphics queue family. - #[allow(dead_code)] + #[expect(dead_code)] pub(crate) graphics_queue_index: u32, /// Surface extension loader. pub(crate) surface_loader: khr::surface::Instance, @@ -37,7 +37,7 @@ pub struct Renderer { /// Images acquired from the swapchain. pub(crate) swapchain_images: Vec, /// The pixel format of the swapchain images. - #[allow(dead_code)] + #[expect(dead_code)] pub(crate) swapchain_format: vk::Format, /// The dimensions of the swapchain images. pub(crate) swapchain_extent: vk::Extent2D, @@ -262,7 +262,7 @@ impl Renderer { self.graphics_pipeline, ); - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let viewport = vk::Viewport { x: 0.0, y: 0.0, @@ -284,10 +284,9 @@ impl Renderer { self.device .cmd_bind_index_buffer(cmd, self.index_buffer, 0, vk::IndexType::UINT32); - #[allow(clippy::cast_precision_loss)] let aspect = f64::from(self.swapchain_extent.width) / f64::from(self.swapchain_extent.height); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let mut projection = glam::Mat4::perspective_rh(45.0_f32.to_radians(), aspect as f32, 0.1, 500.0); // Vulkan clip space inverts the Y axis relative to the OpenGL convention glam targets. @@ -349,7 +348,7 @@ impl Renderer { /// /// # Errors /// Returns a `RendererError` if new Vulkan buffers cannot be allocated or created. - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] pub fn update_mesh( &mut self, vertices: &[Vertex], diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index dc2eb4f..2f0f198 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs @@ -26,11 +26,11 @@ fn main() { info!("Starting Synvael server"); - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let config_str = fs::read_to_string("assets/data/worldgen/default.json") .expect("Failed to read worldgen config"); - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let worldgen_config: WorldGenConfig = serde_json::from_str(&config_str).expect("Failed to parse worldgen config"); diff --git a/crates/shared/src/generator.rs b/crates/shared/src/generator.rs index 9cb2b13..d180459 100644 --- a/crates/shared/src/generator.rs +++ b/crates/shared/src/generator.rs @@ -41,11 +41,7 @@ impl VoxelGenerator { /// Generates a complete voxel chunk for the specified position. #[must_use] - #[allow( - clippy::cast_precision_loss, - clippy::cast_possible_wrap, - clippy::cast_possible_truncation - )] + #[expect(clippy::cast_possible_wrap, clippy::cast_possible_truncation)] pub fn generate_chunk(&self, pos: ChunkPos) -> Chunk { let mut chunk = Chunk::default(); diff --git a/crates/shared/src/world.rs b/crates/shared/src/world.rs index f5d561f..7eb7849 100644 --- a/crates/shared/src/world.rs +++ b/crates/shared/src/world.rs @@ -89,7 +89,7 @@ impl ChunkPos { /// Initializes a new chunk position from a world-space position measured in blocks. #[must_use] - #[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_truncation, clippy::cast_possible_wrap)] pub fn from_world(x: f64, y: f64, z: f64) -> Self { ChunkPos { x: (x.floor() as i32).div_euclid(CHUNK_SIZE as i32),