The syntax as written can't work, since an if condition guard is part of the match arm, not part of the pattern. The closest equivalent I could think of would be to repeat the checks in the guard:
If the alternative is simply to do nothing when the arm doesn't match, an early return would work (this could be written as either an if or a nested match):
There’s unfortunately no way of applying a guard just to a part of an or pattern. In your particular code example, I would probably write something like
if matches!(event.code, KeyCode::char('q))
|| matches!(event.code, KeyCode::Char('c) if event.modifiers == KeyModifiers::CONTROL)
{
app.is_running = false
}
You could also try to use pattern matching instead of == for the .modifiers (not 100% sure if that works though for that type)… perhaps even matching on the whole event: