Skip to content

Commit

Permalink
Use map_or instead of map followed by unwrap_or
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Nov 2, 2024
1 parent 4cc2c31 commit aa572c9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ impl Monitor {
.find(&display_serial_key)
.and_then(|x| x.downcast::<CFNumber>())
.and_then(|x| x.to_i32())
.map(|x| x as u32)
.unwrap_or(0);
.map_or(0, |x| x as u32);

if display_vendor == display.vendor_number()
&& display_product == display.model_number()
Expand Down

0 comments on commit aa572c9

Please sign in to comment.