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
This commit is contained in:
commit
36b7983580
@ -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;
|
||||
}
|
||||
|
||||
|
6
tests/ui/unnested_or_patterns3.rs
Normal file
6
tests/ui/unnested_or_patterns3.rs
Normal file
@ -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) {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user