Skip to content

Commit 7b6dc7b

Browse files
Centrilflip1995
authored andcommitted
add unnested_or_patterns lint
1 parent 67ec96c commit 7b6dc7b

15 files changed

+1314
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,7 @@ Released 2018-09-13
16831683
[`unnecessary_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
16841684
[`unneeded_field_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_field_pattern
16851685
[`unneeded_wildcard_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_wildcard_pattern
1686+
[`unnested_or_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
16861687
[`unreachable`]: https://rust-lang.github.io/rust-clippy/master/index.html#unreachable
16871688
[`unreadable_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
16881689
[`unsafe_derive_deserialize`]: https://rust-lang.github.io/rust-clippy/master/index.html#unsafe_derive_deserialize

clippy_lints/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// error-pattern:cargo-clippy
22

3+
#![feature(bindings_after_at)]
34
#![feature(box_syntax)]
45
#![feature(box_patterns)]
56
#![feature(or_patterns)]
@@ -12,6 +13,7 @@
1213
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
1314
#![feature(crate_visibility_modifier)]
1415
#![feature(concat_idents)]
16+
#![feature(drain_filter)]
1517

1618
// FIXME: switch to something more ergonomic here, once available.
1719
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
@@ -319,6 +321,7 @@ mod types;
319321
mod unicode;
320322
mod unnamed_address;
321323
mod unnecessary_sort_by;
324+
mod unnested_or_patterns;
322325
mod unsafe_removed_from_name;
323326
mod unused_io_amount;
324327
mod unused_self;
@@ -836,6 +839,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
836839
&unnamed_address::FN_ADDRESS_COMPARISONS,
837840
&unnamed_address::VTABLE_ADDRESS_COMPARISONS,
838841
&unnecessary_sort_by::UNNECESSARY_SORT_BY,
842+
&unnested_or_patterns::UNNESTED_OR_PATTERNS,
839843
&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
840844
&unused_io_amount::UNUSED_IO_AMOUNT,
841845
&unused_self::UNUSED_SELF,
@@ -1073,6 +1077,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10731077
store.register_early_pass(move || box non_expressive_names::NonExpressiveNames {
10741078
single_char_binding_names_threshold,
10751079
});
1080+
store.register_early_pass(|| box unnested_or_patterns::UnnestedOrPatterns);
10761081

10771082
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
10781083
LintId::of(&arithmetic::FLOAT_ARITHMETIC),
@@ -1433,6 +1438,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14331438
LintId::of(&unnamed_address::FN_ADDRESS_COMPARISONS),
14341439
LintId::of(&unnamed_address::VTABLE_ADDRESS_COMPARISONS),
14351440
LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
1441+
LintId::of(&unnested_or_patterns::UNNESTED_OR_PATTERNS),
14361442
LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
14371443
LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
14381444
LintId::of(&unwrap::PANICKING_UNWRAP),
@@ -1616,6 +1622,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16161622
LintId::of(&types::UNNECESSARY_CAST),
16171623
LintId::of(&types::VEC_BOX),
16181624
LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
1625+
LintId::of(&unnested_or_patterns::UNNESTED_OR_PATTERNS),
16191626
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
16201627
LintId::of(&useless_conversion::USELESS_CONVERSION),
16211628
LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),

0 commit comments

Comments
 (0)