From e591d71ca661990bb34a0af121ecb51913ec8124 Mon Sep 17 00:00:00 2001 From: nanoqsh Date: Sun, 2 Jun 2024 10:37:16 +0500 Subject: [PATCH] Clippy --- dunge/src/window.rs | 13 ------------- examples/cube/src/lib.rs | 2 +- examples/ssaa/src/lib.rs | 2 +- examples/triangle/src/lib.rs | 2 +- examples/window/src/main.rs | 2 +- 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/dunge/src/window.rs b/dunge/src/window.rs index 2759e1b..10a7d49 100644 --- a/dunge/src/window.rs +++ b/dunge/src/window.rs @@ -155,10 +155,6 @@ impl Init { Self::Active(inner) => inner, } } - - fn is_initialized(&self) -> bool { - matches!(self, Self::Active(_)) - } } pub struct View { @@ -190,35 +186,28 @@ impl View { } pub fn window(&self) -> &Arc { - debug_assert!(self.init.is_initialized()); &self.init.get().window } pub fn format(&self) -> Format { - debug_assert!(self.init.is_initialized()); self.format } pub fn size(&self) -> (u32, u32) { - debug_assert!(self.init.is_initialized()); self.size } pub(crate) fn id(&self) -> WindowId { - debug_assert!(self.init.is_initialized()); self.id } pub(crate) fn request_redraw(&self) { - debug_assert!(self.init.is_initialized()); self.init.get().window.request_redraw(); } pub(crate) fn output(&self) -> Result { use wgpu::TextureViewDescriptor; - debug_assert!(self.init.is_initialized()); - let inner = self.init.get(); let format = inner.format(); let output = inner.surface.get_current_texture()?; @@ -235,13 +224,11 @@ impl View { } pub(crate) fn set_window_size(&self) { - debug_assert!(self.init.is_initialized()); let inner = self.init.get(); self.el.set_window_size(&inner.window); } pub(crate) fn resize(&mut self, state: &State) { - debug_assert!(self.init.is_initialized()); let inner = self.init.get_mut(); let size = inner.window.inner_size(); if size.width > 0 && size.height > 0 { diff --git a/examples/cube/src/lib.rs b/examples/cube/src/lib.rs index 656f17c..e2b754c 100644 --- a/examples/cube/src/lib.rs +++ b/examples/cube/src/lib.rs @@ -129,7 +129,7 @@ pub async fn run(ws: dunge::window::WindowState) -> Result<(), Error> { move |mut frame: Frame| { let layer = layer.get_or_init(|| cx.make_layer(&cube_shader, frame.format())); let opts = Rgba::from_standard([0.1, 0.05, 0.15, 1.]); - frame.layer(&layer, opts).bind(&bind_transform).draw(&mesh); + frame.layer(layer, opts).bind(&bind_transform).draw(&mesh); } }; diff --git a/examples/ssaa/src/lib.rs b/examples/ssaa/src/lib.rs index 10e9ea3..7c853e5 100644 --- a/examples/ssaa/src/lib.rs +++ b/examples/ssaa/src/lib.rs @@ -166,7 +166,7 @@ pub async fn run(ws: dunge::window::WindowState) -> Result<(), Error> { screen_layer.get_or_init(|| cx.make_layer(&screen_shader, frame.format())); frame - .layer(&screen_layer, Options::default()) + .layer(screen_layer, Options::default()) .bind(&state.bind_map) .draw(&screen_mesh); } diff --git a/examples/triangle/src/lib.rs b/examples/triangle/src/lib.rs index b15d623..f65d82f 100644 --- a/examples/triangle/src/lib.rs +++ b/examples/triangle/src/lib.rs @@ -58,7 +58,7 @@ pub async fn run(ws: dunge::window::WindowState) -> Result<(), Error> { move |mut frame: Frame| { let opts = Rgba::from_standard([0.1, 0.05, 0.15, 1.]); let layer = layer.get_or_init(|| cx.make_layer(&shader, frame.format())); - frame.layer(&layer, opts).bind(&bind).draw_points(3); + frame.layer(layer, opts).bind(&bind).draw_points(3); } }; diff --git a/examples/window/src/main.rs b/examples/window/src/main.rs index f0f4b87..c59fd81 100644 --- a/examples/window/src/main.rs +++ b/examples/window/src/main.rs @@ -96,7 +96,7 @@ async fn run() -> Result<(), Error> { frame // Select a layer to draw on it - .layer(&layer, bg) + .layer(layer, bg) // The shader has no bindings, so call empty bind .bind_empty() // And finally draw the mesh