Syntactic sugar for all empty match branches

Let x be a result type. Is there a syntactic sugar for something like this:

match x {
    Err(_) => {}
    Ok(_) => {}
}

You mean like this?

match x {
    _ => {}
}

Sorry forgot to mention that x is of result type. Was thinking, there is maybe something even shorter for Result types... Like the "?"..

let _ = foo(); is a common idiom for ignoring a Result.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.