From 3c98b171cf27eb86bd62f71a1a3e4972156cecfd Mon Sep 17 00:00:00 2001 From: Sander Date: Sat, 8 Jun 2024 19:22:30 +0000 Subject: [PATCH] lint --- flux/src/flux.rs | 4 ++-- flux/src/render/color.rs | 2 +- flux/src/render/lines.rs | 10 +++++----- flux/src/render/noise.rs | 5 ++--- flux/src/settings.rs | 7 +++---- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/flux/src/flux.rs b/flux/src/flux.rs index 75f0c12..e80e6da 100644 --- a/flux/src/flux.rs +++ b/flux/src/flux.rs @@ -1,4 +1,3 @@ -use crate::render::texture; use crate::{grid, render, rng, settings}; use settings::Settings; @@ -58,7 +57,8 @@ impl Flux { queue: &wgpu::Queue, texture_view: wgpu::TextureView, ) { - self.lines.update_color_bindings(device, queue, Some(texture_view), None); + self.lines + .update_color_bindings(device, queue, Some(texture_view), None); } pub fn new( diff --git a/flux/src/render/color.rs b/flux/src/render/color.rs index 626a92c..b8706e5 100644 --- a/flux/src/render/color.rs +++ b/flux/src/render/color.rs @@ -1,5 +1,4 @@ use image::{DynamicImage, GenericImage, GenericImageView, Rgba, RgbaImage}; -use std::path; pub enum Problem { ReadImage(std::io::Error), @@ -18,6 +17,7 @@ impl std::fmt::Display for Problem { } pub struct Context { + #[allow(dead_code)] texture: wgpu::Texture, pub texture_view: wgpu::TextureView, } diff --git a/flux/src/render/lines.rs b/flux/src/render/lines.rs index 9a8eacb..a725ce5 100644 --- a/flux/src/render/lines.rs +++ b/flux/src/render/lines.rs @@ -144,7 +144,7 @@ impl Context { mapped_at_creation: false, }); - queue.write_buffer(&self.color_buffer, 0, &bytemuck::cast_slice(&[color_wheel])); + queue.write_buffer(&self.color_buffer, 0, bytemuck::cast_slice(&[color_wheel])); self.color_mode = 1; self.update_color_bindings(device, queue, None, None); @@ -159,7 +159,7 @@ impl Context { } pub fn update_color_bindings( - self: &mut Self, + &mut self, device: &wgpu::Device, queue: &wgpu::Queue, some_color_texture_view: Option, @@ -198,7 +198,7 @@ impl Context { pub fn tick_line_uniforms( &mut self, - device: &wgpu::Device, + _device: &wgpu::Device, queue: &wgpu::Queue, timestep: f32, elapsed_time: f32, @@ -212,7 +212,7 @@ impl Context { ); } - pub fn update_line_color_mode(&mut self, device: &wgpu::Device, queue: &wgpu::Queue) { + pub fn update_line_color_mode(&mut self, _device: &wgpu::Device, queue: &wgpu::Queue) { self.line_uniforms.color_mode = self.color_mode; queue.write_buffer( @@ -317,7 +317,7 @@ impl Context { pub fn new( device: &wgpu::Device, - queue: &wgpu::Queue, + _queue: &wgpu::Queue, swapchain_format: wgpu::TextureFormat, screen_size: wgpu::Extent3d, grid: &Grid, diff --git a/flux/src/render/noise.rs b/flux/src/render/noise.rs index ad314c4..22644d0 100644 --- a/flux/src/render/noise.rs +++ b/flux/src/render/noise.rs @@ -36,7 +36,7 @@ impl NoiseGenerator { depth_or_array_layers: 1, }; - let (texture, texture_view) = create_texture(&device, &size); + let (texture, texture_view) = create_texture(device, &size); self.scaling_ratio = scaling_ratio; self.texture = texture; @@ -484,8 +484,7 @@ impl NoiseUniforms { scale: [ channel.scale * scaling_ratio.x(), channel.scale * scaling_ratio.y(), - ] - .into(), + ], offset_1: channel.offset_1, offset_2: channel.offset_2, blend_factor: channel.blend_factor, diff --git a/flux/src/settings.rs b/flux/src/settings.rs index 7ed835e..cb4aba5 100644 --- a/flux/src/settings.rs +++ b/flux/src/settings.rs @@ -96,9 +96,9 @@ impl Default for ColorMode { } } -impl Into for ColorMode { - fn into(self) -> u32 { - match self { +impl From for u32 { + fn from(val: ColorMode) -> Self { + match val { ColorMode::Preset(ColorPreset::Original) => 0, ColorMode::Preset(_) => 1, ColorMode::ImageFile(_) => 2, @@ -152,4 +152,3 @@ pub static COLOR_SCHEME_POOLSIDE: [f32; 24] = [ 124.0 / 255.0, 220.0 / 255.0, 236.0 / 255.0, 1.0, 156.0 / 255.0, 208.0 / 255.0, 236.0 / 255.0, 1.0, ]; -