Skip to content

Commit 36b7983

Browse files
committed
Auto merge of #5758 - ebroto:5704_unnested_or_pats, r=flip1995
Require `or_patterns` to suggest nesting them changelog: Require `#![feature(or_patterns)]` to trigger [`unnested_or_patterns`] Fixes #5704
2 parents d05d6ab + bff6c43 commit 36b7983

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

clippy_lints/src/unnested_or_patterns.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ impl EarlyLintPass for UnnestedOrPatterns {
7272
}
7373

7474
fn lint_unnested_or_patterns(cx: &EarlyContext<'_>, pat: &Pat) {
75-
if !cx.sess.opts.unstable_features.is_nightly_build() {
76-
// User cannot do `#![feature(or_patterns)]`, so bail.
75+
if !cx.sess.features_untracked().or_patterns {
76+
// Do not suggest nesting the patterns if the feature `or_patterns` is not enabled.
7777
return;
7878
}
7979

tests/ui/unnested_or_patterns3.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![warn(clippy::unnested_or_patterns)]
2+
3+
// Test that `unnested_or_patterns` does not trigger without enabling `or_patterns`
4+
fn main() {
5+
if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {}
6+
}

0 commit comments

Comments
 (0)