From 8d35f51b528b9fbc87b1d71460626b67b08d627d Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 13 Nov 2023 15:33:10 +0100 Subject: [PATCH] Clippy fixes --- crates/eframe/src/native/run.rs | 12 ++++++------ crates/egui/src/context.rs | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index 289c0a895..2407307ca 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -261,7 +261,7 @@ fn run_and_return( } } - let mut next_repaint_time = windows_next_repaint_times.values().min().cloned(); + let mut next_repaint_time = windows_next_repaint_times.values().min().copied(); // This is for not duplicating redraw requests use winit::event::Event; @@ -270,7 +270,7 @@ fn run_and_return( Event::RedrawEventsCleared | Event::RedrawRequested(_) | Event::Resumed ) { windows_next_repaint_times.retain(|window_id, repaint_time| { - if *repaint_time > Instant::now() { + if Instant::now() < *repaint_time { return true; }; @@ -285,7 +285,7 @@ fn run_and_return( } else { false } - }) + }); } if let Some(next_repaint_time) = next_repaint_time { @@ -396,7 +396,7 @@ fn run_and_exit(event_loop: EventLoop, mut winit_app: impl WinitApp + } } - let mut next_repaint_time = windows_next_repaint_times.values().min().cloned(); + let mut next_repaint_time = windows_next_repaint_times.values().min().copied(); // This is for not duplicating redraw requests use winit::event::Event; @@ -405,7 +405,7 @@ fn run_and_exit(event_loop: EventLoop, mut winit_app: impl WinitApp + Event::RedrawEventsCleared | Event::RedrawRequested(_) | Event::Resumed ) { windows_next_repaint_times.retain(|window_id, repaint_time| { - if *repaint_time > Instant::now() { + if Instant::now() < *repaint_time { return true; } @@ -420,7 +420,7 @@ fn run_and_exit(event_loop: EventLoop, mut winit_app: impl WinitApp + } else { false } - }) + }); } if let Some(next_repaint_time) = next_repaint_time { diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index f920c3785..38e60911d 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -226,7 +226,12 @@ impl ContextImpl { self.memory.begin_frame( self.input.get(&viewport_id).unwrap_or(&Default::default()), &new_raw_input, - &ViewportIdSet::from_iter(self.viewports.keys().cloned().chain([ViewportId::ROOT])), + &self + .viewports + .keys() + .copied() + .chain([ViewportId::ROOT]) + .collect(), ); let input = self