From 0dd10bf0fa9e708318e51a95bb2f0942c966f341 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 14 Nov 2023 18:47:29 +0100 Subject: [PATCH] Cleanup: replace `std::iter::once(x)` with `[x]` --- crates/eframe/src/native/run.rs | 8 ++------ crates/eframe/src/web/web_painter_wgpu.rs | 8 +++----- crates/egui-wgpu/src/winit.rs | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index d9749f58313..14584c72029 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -657,7 +657,7 @@ mod glow_integration { if let Some(window) = &viewport.window { let is_viewport_focused = focused_viewport == Some(viewport_id); egui_winit::process_viewport_commands( - std::iter::once(command), + [command], window, is_viewport_focused, ); @@ -2561,11 +2561,7 @@ mod wgpu_integration { .and_then(|vp| vp.window.as_ref()) { let is_viewport_focused = focused_viewport == Some(viewport_id); - egui_winit::process_viewport_commands( - std::iter::once(command), - window, - is_viewport_focused, - ); + egui_winit::process_viewport_commands([command], window, is_viewport_focused); } } diff --git a/crates/eframe/src/web/web_painter_wgpu.rs b/crates/eframe/src/web/web_painter_wgpu.rs index 436dac8181f..d743b52c856 100644 --- a/crates/eframe/src/web/web_painter_wgpu.rs +++ b/crates/eframe/src/web/web_painter_wgpu.rs @@ -270,11 +270,9 @@ impl WebPainter for WebPainterWgpu { } // Submit the commands: both the main buffer and user-defined ones. - render_state.queue.submit( - user_cmd_bufs - .into_iter() - .chain(std::iter::once(encoder.finish())), - ); + render_state + .queue + .submit(user_cmd_bufs.into_iter().chain([encoder.finish()])); if let Some(frame) = frame { frame.present(); diff --git a/crates/egui-wgpu/src/winit.rs b/crates/egui-wgpu/src/winit.rs index d1994e8ad51..68803a24b2b 100644 --- a/crates/egui-wgpu/src/winit.rs +++ b/crates/egui-wgpu/src/winit.rs @@ -615,7 +615,7 @@ impl Painter { crate::profile_scope!("Queue::submit"); render_state .queue - .submit(user_cmd_bufs.into_iter().chain(std::iter::once(encoded))); + .submit(user_cmd_bufs.into_iter().chain([encoded])); }; let screenshot = if capture {