Skip to content

Commit

Permalink
Merge pull request #6 from ttytm/refacotr/map-or
Browse files Browse the repository at this point in the history
Use map_or instead of map followed by unwrap_or
  • Loading branch information
haimgel authored Nov 5, 2024
2 parents 958f4ad + aa572c9 commit d889bad
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 d889bad

Please sign in to comment.