Skip to content

Commit b5cadd7

Browse files
committed
ignore single-match for or patterns
1 parent 982c51e commit b5cadd7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clippy_lints/src/matches.rs

+5
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches {
255255
#[rustfmt::skip]
256256
fn check_single_match(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: &Expr) {
257257
if arms.len() == 2 && arms[0].guard.is_none() && arms[1].guard.is_none() {
258+
if let PatKind::Or(..) = arms[0].pat.node {
259+
// don't lint for or patterns for now, this makes
260+
// the lint noisy in unnecessary situations
261+
return;
262+
}
258263
let els = remove_blocks(&arms[1].body);
259264
let els = if is_unit_expr(els) {
260265
None

0 commit comments

Comments
 (0)