From 1331e02cab0a48be3a52a01b960ffdc5f45d5a51 Mon Sep 17 00:00:00 2001 From: Sawyer McLane Date: Sun, 12 Jan 2025 07:05:18 -0700 Subject: [PATCH] Refactor device info and UI logic to use is_some_and for improved readability --- src/device_info.rs | 2 +- src/ui.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/device_info.rs b/src/device_info.rs index 32ae66e..3faace1 100644 --- a/src/device_info.rs +++ b/src/device_info.rs @@ -284,7 +284,7 @@ impl GroupInfo { b.group .data .as_ref() - .map_or(false, |g: &GroupInfo| g.group == self.group) + .is_some_and(|g: &GroupInfo| g.group == self.group) }) .collect() } diff --git a/src/ui.rs b/src/ui.rs index f5cbbbd..fd65994 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -147,10 +147,7 @@ pub fn handle_screencap( ); } - let is_active = app - .waveform_map - .get(&device.id()) - .map_or(false, |w| w.active); + let is_active = app.waveform_map.get(&device.id()).is_some_and(|w| w.active); if create_highlighted_button(ui, "monitor", MONITOR_ICON, is_active).clicked() { if let Some(waveform) = app.waveform_map.get_mut(&device.id()) { waveform.active = !waveform.active;