Repository: alacritty/alacritty
File: alacritty/src/config/bindings.rs (Rust)

Code before:
                let action = match (action, chars, command) {
                    (Some(action @ Action::ViMotion(_)), None, None)
                    | (Some(action @ Action::Vi(_)), None, None) => {
                        if !mode.intersects(BindingMode::VI) || not_mode.intersects(BindingMode::VI)
                        {
                            return Err(V::Error::custom(format!(
                                "action `{}` is only available in vi mode, try adding `mode: Vi`",
                                action,
                            )));
                        }
                        action
                    },
                    (Some(action @ Action::Search(_)), None, None) => {
                        if !mode.intersects(BindingMode::SEARCH) {
                            return Err(V::Error::custom(format!(
                                "action `{}` is only available in search mode, try adding `mode: \
                                 Search`",
                                action,
                            )));
                        }
                        action
                    },
                    (Some(action @ Action::Mouse(_)), None, None) => {
                        if mouse.is_none() {
                            return Err(V::Error::custom(format!(
                                "action `{}` is only available in mouse binding",
                                action,
                            )));
                        }
                        action
                    },
                    (Some(action), None, None) => action,
                    (None, Some(chars), None) => Action::Esc(chars),
                    (None, None, Some(cmd)) => Action::Command(cmd),
                    _ => {
                        return Err(V::Error::custom(
                            "must specify exactly one of chars, action or command",
                        ))
                    },
                };

                if mouse.is_none() && key.is_none() {
                    return Err(V::Error::custom("bindings require mouse button or key"));
                }

                Ok(RawBinding { mode, notmode: not_mode, action, key, mouse, mods })
            }
        }

        deserializer.deserialize_struct("RawBinding", FIELDS, RawBindingVisitor)
    }

Review comment (suggestion):
```suggestion
                                "action `{}` is only available for mouse bindings",
```

Code after:
                    (Some(action @ Action::ViMotion(_)), None, None)
                    | (Some(action @ Action::Vi(_)), None, None) => {
                        if !mode.intersects(BindingMode::VI) || not_mode.intersects(BindingMode::VI)
                        {
                            return Err(V::Error::custom(format!(
                                "action `{}` is only available in vi mode, try adding `mode: Vi`",
                                action,
                            )));
                        }
                        action
                    },
                    (Some(action @ Action::Search(_)), None, None) => {
                        if !mode.intersects(BindingMode::SEARCH) {
                            return Err(V::Error::custom(format!(
                                "action `{}` is only available in search mode, try adding `mode: \
                                 Search`",
                                action,
                            )));
                        }
                        action
                    },
                    (Some(action @ Action::Mouse(_)), None, None) => {
                        if mouse.is_none() {
                            return Err(V::Error::custom(format!(
                                "action `{}` is only available for mouse bindings",
                                action,
                            )));
                        }
                        action
                    },
                    (Some(action), None, None) => action,
                    (None, Some(chars), None) => Action::Esc(chars),
                    (None, None, Some(cmd)) => Action::Command(cmd),
                    _ => {
                        return Err(V::Error::custom(
                            "must specify exactly one of chars, action or command",
                        ))
                    },
                };

                if mouse.is_none() && key.is_none() {
                    return Err(V::Error::custom("bindings require mouse button or key"));
                }

                Ok(RawBinding { mode, notmode: not_mode, action, key, mouse, mods })
            }
        }

        deserializer.deserialize_struct("RawBinding", FIELDS, RawBindingVisitor)
    }
}