Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clippy_lints/src/unnested_or_patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ impl EarlyLintPass for UnnestedOrPatterns {
}

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

Expand Down
6 changes: 6 additions & 0 deletions tests/ui/unnested_or_patterns3.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![warn(clippy::unnested_or_patterns)]

// Test that `unnested_or_patterns` does not trigger without enabling `or_patterns`
fn main() {
if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {}
}