Clippy fixes

This commit is contained in:
Lauri Räsänen 2023-11-04 15:22:40 +02:00
parent ebef7fe1c5
commit 2dc20ad12c
6 changed files with 9 additions and 13 deletions

View file

@ -28,9 +28,6 @@ impl Vertex for InstanceRaw {
use std::mem;
wgpu::VertexBufferLayout {
array_stride: mem::size_of::<InstanceRaw>() 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

View file

@ -33,7 +33,7 @@ impl LightUniform {
position,
_padding: 0,
color,
matrices: matrices,
matrices,
}
}
}

View file

@ -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,

View file

@ -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),
})
})

View file

@ -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 {

View file

@ -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 {