Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
nanoqsh committed Jun 2, 2024
1 parent 913efb2 commit e591d71
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 17 deletions.
13 changes: 0 additions & 13 deletions dunge/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ impl Init {
Self::Active(inner) => inner,
}
}

fn is_initialized(&self) -> bool {
matches!(self, Self::Active(_))
}
}

pub struct View {
Expand Down Expand Up @@ -190,35 +186,28 @@ impl View {
}

pub fn window(&self) -> &Arc<window::Window> {
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<Output, SurfaceError> {
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()?;
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/cube/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
2 changes: 1 addition & 1 deletion examples/ssaa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/triangle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
2 changes: 1 addition & 1 deletion examples/window/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e591d71

Please sign in to comment.