From 2dc20ad12ca4e73e5dbf37b9dafa4524887e3c08 Mon Sep 17 00:00:00 2001 From: nullprop Date: Sat, 4 Nov 2023 15:22:40 +0200 Subject: [PATCH] Clippy fixes --- src/core/instance.rs | 3 --- src/core/light.rs | 2 +- src/core/pass.rs | 6 +++--- src/core/state.rs | 2 +- src/core/texture.rs | 4 ++-- src/core/window.rs | 5 ++--- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/core/instance.rs b/src/core/instance.rs index d4a40e8..cee89b5 100644 --- a/src/core/instance.rs +++ b/src/core/instance.rs @@ -28,9 +28,6 @@ impl Vertex for InstanceRaw { use std::mem; wgpu::VertexBufferLayout { array_stride: mem::size_of::() as wgpu::BufferAddress, - // We need to switch from using a step mode of Vertex to Instance - // This means that our shaders will only change to use the next - // instance when the shader starts processing a new instance step_mode: wgpu::VertexStepMode::Instance, attributes: &[ // model matrix diff --git a/src/core/light.rs b/src/core/light.rs index ba8d185..bfd2f89 100644 --- a/src/core/light.rs +++ b/src/core/light.rs @@ -33,7 +33,7 @@ impl LightUniform { position, _padding: 0, color, - matrices: matrices, + matrices, } } } diff --git a/src/core/pass.rs b/src/core/pass.rs index c819568..0224b4f 100644 --- a/src/core/pass.rs +++ b/src/core/pass.rs @@ -22,8 +22,8 @@ impl RenderPass { ) -> Self { let layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some((label.to_owned() + " pipeline Layout").as_str()), - bind_group_layouts: bind_group_layouts, - push_constant_ranges: push_constant_ranges, + bind_group_layouts, + push_constant_ranges, }); let shader = wgpu::ShaderModuleDescriptor { label: Some(shader_name), @@ -80,7 +80,7 @@ impl RenderPass { entry_point: "vs_main", buffers: vertex_layouts, }, - fragment: fragment, + fragment, primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleList, strip_index_format: None, diff --git a/src/core/state.rs b/src/core/state.rs index 0610a3c..d4d1390 100644 --- a/src/core/state.rs +++ b/src/core/state.rs @@ -165,7 +165,7 @@ impl State { aspect: wgpu::TextureAspect::All, base_mip_level: 0, mip_level_count: None, - base_array_layer: i as u32, + base_array_layer: i, array_layer_count: Some(1), }) }) diff --git a/src/core/texture.rs b/src/core/texture.rs index be5de8d..daae949 100644 --- a/src/core/texture.rs +++ b/src/core/texture.rs @@ -20,8 +20,8 @@ impl Texture { usage: wgpu::TextureUsages, ) -> Self { let size = wgpu::Extent3d { - width: width, - height: height, + width, + height, depth_or_array_layers: layers, }; let desc = wgpu::TextureDescriptor { diff --git a/src/core/window.rs b/src/core/window.rs index bd14a33..0a4e266 100644 --- a/src/core/window.rs +++ b/src/core/window.rs @@ -120,15 +120,14 @@ pub async fn run() { fn lock_cursor(window: &winit::window::Window, lock: bool) { if lock { - match window + if let Err(e) = window .set_cursor_grab(if cfg!(target_arch = "wasm32") { winit::window::CursorGrabMode::Locked } else { winit::window::CursorGrabMode::Confined }) { - Err(e) => println!("Failed to grab cursor {e:?}"), - _ => () + println!("Failed to grab cursor {e:?}") } window.set_cursor_visible(false); } else {