summaryrefslogtreecommitdiff
path: root/alacritty_terminal
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty_terminal')
-rw-r--r--alacritty_terminal/src/ansi.rs5
-rw-r--r--alacritty_terminal/src/grid/row.rs2
-rw-r--r--alacritty_terminal/src/tty/unix.rs2
3 files changed, 5 insertions, 4 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs
index e30ed0f5..3f33a1cb 100644
--- a/alacritty_terminal/src/ansi.rs
+++ b/alacritty_terminal/src/ansi.rs
@@ -1155,8 +1155,9 @@ where
let mut params_iter = params.iter();
let handler = &mut self.handler;
- let mut next_param_or = |default: u16| {
- params_iter.next().map(|param| param[0]).filter(|&param| param != 0).unwrap_or(default)
+ let mut next_param_or = |default: u16| match params_iter.next() {
+ Some(&[param, ..]) if param != 0 => param,
+ _ => default,
};
match (action, intermediates) {
diff --git a/alacritty_terminal/src/grid/row.rs b/alacritty_terminal/src/grid/row.rs
index 900d2a76..2a92a78c 100644
--- a/alacritty_terminal/src/grid/row.rs
+++ b/alacritty_terminal/src/grid/row.rs
@@ -76,7 +76,7 @@ impl<T: Clone + Default> Row<T> {
// Split off cells for a new row.
let mut new_row = self.inner.split_off(columns);
- let index = new_row.iter().rposition(|c| !c.is_empty()).map(|i| i + 1).unwrap_or(0);
+ let index = new_row.iter().rposition(|c| !c.is_empty()).map_or(0, |i| i + 1);
new_row.truncate(index);
self.occ = min(self.occ, columns);
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index 2bb5e973..d1e5bdb5 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -173,7 +173,7 @@ pub fn new(config: &PtyConfig, window_size: WindowSize, window_id: Option<usize>
// Set $SHELL environment variable on macOS, since login does not do it for us.
#[cfg(target_os = "macos")]
- builder.env("SHELL", config.shell.as_ref().map(|sh| sh.program()).unwrap_or(pw.shell));
+ builder.env("SHELL", config.shell.as_ref().map_or(pw.shell, Program::program));
if let Some(window_id) = window_id {
builder.env("WINDOWID", format!("{}", window_id));