Skip to content

Commit

Permalink
Refactor device info and UI logic to use is_some_and for improved rea…
Browse files Browse the repository at this point in the history
…dability
  • Loading branch information
samclane committed Jan 12, 2025
1 parent 8bee33e commit 1331e02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/device_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
5 changes: 1 addition & 4 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1331e02

Please sign in to comment.