RS.CLIPPY.SINGLE_MATCH_ELSE
A `match` statement with two arms where the second arm's pattern is a placeholder instead of a specific match pattern
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: single_match_else. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for matches with two arms where an if let else will
usually suffice.
Why is this bad?
Just readability – if let nests less than a match.
Known problems
Personal style preferences may differ.
Example
Using match:
match x {
Some(ref foo) => bar(foo),
_ => bar(&other_ref),
}
Using if let with else:
if let Some(ref foo) = x {
bar(foo);
} else {
bar(&other_ref);
}