From 555ea9f7aa7d708636d6bb68575c9c99d9f363da Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Mon, 26 Aug 2024 22:31:26 +0900 Subject: [PATCH] Refactor: use `if let` instead of `for` on `Option`s (#4934) This is recommended by `rust-analyzer` It might be a good idea to fix this to appease `rust-analyzer`. --- crates/egui/src/context.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index d1a05db4bc2..a4ca219a1b4 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1926,10 +1926,10 @@ impl Context { paint_widget_id(widget, "hovered", Color32::WHITE); } } - for &widget in &clicked { + if let Some(widget) = clicked { paint_widget_id(widget, "clicked", Color32::RED); } - for &widget in &dragged { + if let Some(widget) = dragged { paint_widget_id(widget, "dragged", Color32::GREEN); } } @@ -1948,10 +1948,10 @@ impl Context { paint_widget(widget, "contains_pointer", Color32::BLUE); } } - for widget in &click { + if let Some(widget) = &click { paint_widget(widget, "click", Color32::RED); } - for widget in &drag { + if let Some(widget) = &drag { paint_widget(widget, "drag", Color32::GREEN); } }