diff options
author | Chris Copeland <chris@chrisnc.net> | 2022-07-20 01:24:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 11:24:27 +0300 |
commit | 48454c004700e359c3c496871643913fb20de84f (patch) | |
tree | 754d68e806486a02ac8ce088e87e7c7105832e4a /alacritty/src/display/mod.rs | |
parent | 2a676dfad837d1784ed0911d314bc263804ef4ef (diff) | |
download | r-alacritty-48454c004700e359c3c496871643913fb20de84f.tar.gz r-alacritty-48454c004700e359c3c496871643913fb20de84f.tar.bz2 r-alacritty-48454c004700e359c3c496871643913fb20de84f.zip |
Replace `map().unwrap_or()` with `map_or()`
Use a `map_or` instead of a `map().unwrap_or()` chain.
Diffstat (limited to 'alacritty/src/display/mod.rs')
-rw-r--r-- | alacritty/src/display/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index 79e57307..ec3f9ac7 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -403,7 +403,7 @@ impl Display { // Guess scale_factor based on first monitor. On Wayland the initial frame always renders at // a scale factor of 1. let estimated_scale_factor = if cfg!(any(target_os = "macos", windows)) || is_x11 { - event_loop.available_monitors().next().map(|m| m.scale_factor()).unwrap_or(1.) + event_loop.available_monitors().next().map_or(1., |m| m.scale_factor()) } else { 1. }; @@ -628,7 +628,7 @@ impl Display { // Update number of column/lines in the viewport. let message_bar_lines = - message_buffer.message().map(|m| m.text(&self.size_info).len()).unwrap_or(0); + message_buffer.message().map_or(0, |m| m.text(&self.size_info).len()); let search_lines = if search_active { 1 } else { 0 }; self.size_info.reserve_lines(message_bar_lines + search_lines); @@ -997,7 +997,7 @@ impl Display { if highlighted_hint.is_some() { // If mouse changed the line, we should update the hyperlink preview, since the // highlighted hint could be disrupted by the old preview. - dirty = self.hint_mouse_point.map(|p| p.line != point.line).unwrap_or(false); + dirty = self.hint_mouse_point.map_or(false, |p| p.line != point.line); self.hint_mouse_point = Some(point); self.window.set_mouse_cursor(CursorIcon::Hand); } else if self.highlighted_hint.is_some() { |