From 6fd2409b4f9fc478727d93844799696d328740dc Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Thu, 26 Jan 2023 16:26:38 -0800 Subject: [PATCH] Clippy --- examples/cube.rs | 16 ++++++++-------- examples/custom-texture.rs | 16 ++++++++-------- examples/hello-world.rs | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/cube.rs b/examples/cube.rs index a7df4d0..136ec6b 100644 --- a/examples/cube.rs +++ b/examples/cube.rs @@ -341,7 +341,7 @@ fn main() { width: 1280.0, height: 720.0, }); - window.set_title(&format!("imgui-wgpu {}", version)); + window.set_title(&format!("imgui-wgpu {version}")); let size = window.inner_size(); let surface = unsafe { instance.create_surface(&window) }; @@ -365,8 +365,8 @@ fn main() { let surface_desc = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, format: wgpu::TextureFormat::Bgra8UnormSrgb, - width: size.width as u32, - height: size.height as u32, + width: size.width, + height: size.height, present_mode: wgpu::PresentMode::Fifo, alpha_mode: wgpu::CompositeAlphaMode::Auto, }; @@ -452,8 +452,8 @@ fn main() { let surface_desc = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, format: wgpu::TextureFormat::Bgra8UnormSrgb, - width: size.width as u32, - height: size.height as u32, + width: size.width, + height: size.height, present_mode: wgpu::PresentMode::Fifo, alpha_mode: wgpu::CompositeAlphaMode::Auto, }; @@ -488,7 +488,7 @@ fn main() { let frame = match surface.get_current_texture() { Ok(frame) => frame, Err(e) => { - eprintln!("dropped frame: {:?}", e); + eprintln!("dropped frame: {e:?}"); return; } }; @@ -513,7 +513,7 @@ fn main() { .size([512.0, 512.0], Condition::FirstUseEver) .build(|| { new_example_size = Some(ui.content_region_avail()); - imgui::Image::new(example_texture_id, new_example_size.unwrap()).build(&ui); + imgui::Image::new(example_texture_id, new_example_size.unwrap()).build(ui); }); if let Some(size) = new_example_size { @@ -551,7 +551,7 @@ fn main() { if last_cursor != Some(ui.mouse_cursor()) { last_cursor = Some(ui.mouse_cursor()); - platform.prepare_render(&ui, &window); + platform.prepare_render(ui, &window); } let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { diff --git a/examples/custom-texture.rs b/examples/custom-texture.rs index 8d72632..35b5d95 100644 --- a/examples/custom-texture.rs +++ b/examples/custom-texture.rs @@ -27,7 +27,7 @@ fn main() { width: 1280.0, height: 720.0, }); - window.set_title(&format!("imgui-wgpu {}", version)); + window.set_title(&format!("imgui-wgpu {version}")); let size = window.inner_size(); let surface = unsafe { instance.create_surface(&window) }; @@ -58,8 +58,8 @@ fn main() { let surface_desc = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, format: wgpu::TextureFormat::Bgra8UnormSrgb, - width: size.width as u32, - height: size.height as u32, + width: size.width, + height: size.height, present_mode: wgpu::PresentMode::Fifo, alpha_mode: wgpu::CompositeAlphaMode::Auto, }; @@ -149,8 +149,8 @@ fn main() { let surface_desc = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, format: wgpu::TextureFormat::Bgra8UnormSrgb, - width: size.width as u32, - height: size.height as u32, + width: size.width, + height: size.height, present_mode: wgpu::PresentMode::Fifo, alpha_mode: wgpu::CompositeAlphaMode::Auto, }; @@ -187,7 +187,7 @@ fn main() { let frame = match surface.get_current_texture() { Ok(frame) => frame, Err(e) => { - eprintln!("dropped frame: {:?}", e); + eprintln!("dropped frame: {e:?}"); return; } }; @@ -204,7 +204,7 @@ fn main() { .build(|| { ui.text("Hello textures!"); ui.text("Say hello to checker.png"); - Image::new(lenna_texture_id, size).build(&ui); + Image::new(lenna_texture_id, size).build(ui); }); } @@ -213,7 +213,7 @@ fn main() { if last_cursor != Some(ui.mouse_cursor()) { last_cursor = Some(ui.mouse_cursor()); - platform.prepare_render(&ui, &window); + platform.prepare_render(ui, &window); } let view = frame diff --git a/examples/hello-world.rs b/examples/hello-world.rs index fda9110..f93000d 100644 --- a/examples/hello-world.rs +++ b/examples/hello-world.rs @@ -28,7 +28,7 @@ fn main() { width: 1280.0, height: 720.0, }); - window.set_title(&format!("imgui-wgpu {}", version)); + window.set_title(&format!("imgui-wgpu {version}")); let size = window.inner_size(); let surface = unsafe { instance.create_surface(&window) }; @@ -52,8 +52,8 @@ fn main() { let surface_desc = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, format: wgpu::TextureFormat::Bgra8UnormSrgb, - width: size.width as u32, - height: size.height as u32, + width: size.width, + height: size.height, present_mode: wgpu::PresentMode::Fifo, alpha_mode: wgpu::CompositeAlphaMode::Auto, }; @@ -121,8 +121,8 @@ fn main() { let surface_desc = wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, format: wgpu::TextureFormat::Bgra8UnormSrgb, - width: size.width as u32, - height: size.height as u32, + width: size.width, + height: size.height, present_mode: wgpu::PresentMode::Fifo, alpha_mode: wgpu::CompositeAlphaMode::Auto, }; @@ -158,7 +158,7 @@ fn main() { let frame = match surface.get_current_texture() { Ok(frame) => frame, Err(e) => { - eprintln!("dropped frame: {:?}", e); + eprintln!("dropped frame: {e:?}"); return; } }; @@ -187,7 +187,7 @@ fn main() { .size([400.0, 200.0], Condition::FirstUseEver) .position([400.0, 200.0], Condition::FirstUseEver) .build(|| { - ui.text(format!("Frametime: {:?}", delta_s)); + ui.text(format!("Frametime: {delta_s:?}")); }); ui.show_demo_window(&mut demo_open); @@ -198,7 +198,7 @@ fn main() { if last_cursor != Some(ui.mouse_cursor()) { last_cursor = Some(ui.mouse_cursor()); - platform.prepare_render(&ui, &window); + platform.prepare_render(ui, &window); } let view = frame