Skip to content

Commit

Permalink
Cleanup: replace std::iter::once(x) with [x]
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 14, 2023
1 parent 1090d2d commit 0dd10bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
8 changes: 2 additions & 6 deletions crates/eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down Expand Up @@ -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);
}
}

Expand Down
8 changes: 3 additions & 5 deletions crates/eframe/src/web/web_painter_wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion crates/egui-wgpu/src/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0dd10bf

Please sign in to comment.