diff --git a/CHANGELOG.md b/CHANGELOG.md index 045c269d62a..5193db5a35d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4949,7 +4949,7 @@ Released 2018-09-13 [`manual_non_exhaustive`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive [`manual_ok_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_or [`manual_range_contains`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains -[`manual_range_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_pattern +[`manual_range_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_patterns [`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid [`manual_retain`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain [`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index 53d92c089ea..881ff9baf18 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -278,7 +278,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::manual_let_else::MANUAL_LET_ELSE_INFO, crate::manual_main_separator_str::MANUAL_MAIN_SEPARATOR_STR_INFO, crate::manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE_INFO, - crate::manual_range_pattern::MANUAL_RANGE_PATTERN_INFO, + crate::manual_range_patterns::MANUAL_RANGE_PATTERNS_INFO, crate::manual_rem_euclid::MANUAL_REM_EUCLID_INFO, crate::manual_retain::MANUAL_RETAIN_INFO, crate::manual_slice_size_calculation::MANUAL_SLICE_SIZE_CALCULATION_INFO, diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index d23dd29f815..0c71fdccae0 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -188,7 +188,7 @@ mod manual_is_ascii_check; mod manual_let_else; mod manual_main_separator_str; mod manual_non_exhaustive; -mod manual_range_pattern; +mod manual_range_patterns; mod manual_rem_euclid; mod manual_retain; mod manual_slice_size_calculation; @@ -1069,7 +1069,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: needless_raw_string_hashes_allow_one, }) }); - store.register_late_pass(|_| Box::new(manual_range_pattern::ManualRangePattern)); + store.register_late_pass(|_| Box::new(manual_range_patterns::ManualRangePatterns)); // add lints here, do not remove this comment, it's used in `new_lint` } diff --git a/clippy_lints/src/manual_range_pattern.rs b/clippy_lints/src/manual_range_patterns.rs similarity index 95% rename from clippy_lints/src/manual_range_pattern.rs rename to clippy_lints/src/manual_range_patterns.rs index 0ef75792b7a..65ff555209a 100644 --- a/clippy_lints/src/manual_range_pattern.rs +++ b/clippy_lints/src/manual_range_patterns.rs @@ -30,11 +30,11 @@ declare_clippy_lint! { /// let foo = matches!(x, 1..=10); /// ``` #[clippy::version = "1.72.0"] - pub MANUAL_RANGE_PATTERN, + pub MANUAL_RANGE_PATTERNS, complexity, "manually writing range patterns using a combined OR pattern (`|`)" } -declare_lint_pass!(ManualRangePattern => [MANUAL_RANGE_PATTERN]); +declare_lint_pass!(ManualRangePatterns => [MANUAL_RANGE_PATTERNS]); fn expr_as_u128(expr: &Expr<'_>) -> Option { if let ExprKind::Lit(lit) = expr.kind @@ -46,7 +46,7 @@ fn expr_as_u128(expr: &Expr<'_>) -> Option { } } -impl LateLintPass<'_> for ManualRangePattern { +impl LateLintPass<'_> for ManualRangePatterns { fn check_pat(&mut self, cx: &LateContext<'_>, pat: &'_ rustc_hir::Pat<'_>) { if in_external_macro(cx.sess(), pat.span) { return; @@ -110,7 +110,7 @@ impl LateLintPass<'_> for ManualRangePattern { if contains_whole_range { span_lint_and_sugg( cx, - MANUAL_RANGE_PATTERN, + MANUAL_RANGE_PATTERNS, pat.span, "this OR pattern can be rewritten using a range", "try", diff --git a/tests/ui/manual_range_pattern.fixed b/tests/ui/manual_range_patterns.fixed similarity index 95% rename from tests/ui/manual_range_pattern.fixed rename to tests/ui/manual_range_patterns.fixed index 14a5f822d60..9eee8f37187 100644 --- a/tests/ui/manual_range_pattern.fixed +++ b/tests/ui/manual_range_patterns.fixed @@ -1,7 +1,7 @@ //@run-rustfix #![allow(unused)] -#![warn(clippy::manual_range_pattern)] +#![warn(clippy::manual_range_patterns)] #![feature(exclusive_range_pattern)] fn main() { diff --git a/tests/ui/manual_range_pattern.rs b/tests/ui/manual_range_patterns.rs similarity index 96% rename from tests/ui/manual_range_pattern.rs rename to tests/ui/manual_range_patterns.rs index ea63953af04..10743a7d04c 100644 --- a/tests/ui/manual_range_pattern.rs +++ b/tests/ui/manual_range_patterns.rs @@ -1,7 +1,7 @@ //@run-rustfix #![allow(unused)] -#![warn(clippy::manual_range_pattern)] +#![warn(clippy::manual_range_patterns)] #![feature(exclusive_range_pattern)] fn main() { diff --git a/tests/ui/manual_range_pattern.stderr b/tests/ui/manual_range_patterns.stderr similarity index 83% rename from tests/ui/manual_range_pattern.stderr rename to tests/ui/manual_range_patterns.stderr index a8969ede4e0..bc9e3350164 100644 --- a/tests/ui/manual_range_pattern.stderr +++ b/tests/ui/manual_range_patterns.stderr @@ -1,43 +1,43 @@ error: this OR pattern can be rewritten using a range - --> $DIR/manual_range_pattern.rs:10:25 + --> $DIR/manual_range_patterns.rs:10:25 | LL | let _ = matches!(f, 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` | - = note: `-D clippy::manual-range-pattern` implied by `-D warnings` + = note: `-D clippy::manual-range-patterns` implied by `-D warnings` error: this OR pattern can be rewritten using a range - --> $DIR/manual_range_pattern.rs:11:25 + --> $DIR/manual_range_patterns.rs:11:25 | LL | let _ = matches!(f, 4 | 2 | 3 | 1 | 5 | 6 | 9 | 7 | 8 | 10); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` error: this OR pattern can be rewritten using a range - --> $DIR/manual_range_pattern.rs:20:25 + --> $DIR/manual_range_patterns.rs:20:25 | LL | let _ = matches!(f, (1..=10) | (2..=13) | (14..=48324728) | 48324729); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=48324729` error: this OR pattern can be rewritten using a range - --> $DIR/manual_range_pattern.rs:21:25 + --> $DIR/manual_range_patterns.rs:21:25 | LL | let _ = matches!(f, 0 | (1..=10) | 48324730 | (2..=13) | (14..=48324728) | 48324729); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `0..=48324730` error: this OR pattern can be rewritten using a range - --> $DIR/manual_range_pattern.rs:22:25 + --> $DIR/manual_range_patterns.rs:22:25 | LL | let _ = matches!(f, 0..=1 | 0..=2 | 0..=3); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `0..=3` error: this OR pattern can be rewritten using a range - --> $DIR/manual_range_pattern.rs:25:9 + --> $DIR/manual_range_patterns.rs:25:9 | LL | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 => true, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` error: this OR pattern can be rewritten using a range - --> $DIR/manual_range_pattern.rs:31:26 + --> $DIR/manual_range_patterns.rs:31:26 | LL | matches!($e, 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10` diff --git a/tests/ui/unnested_or_patterns.fixed b/tests/ui/unnested_or_patterns.fixed index ca999f241f7..738045595c0 100644 --- a/tests/ui/unnested_or_patterns.fixed +++ b/tests/ui/unnested_or_patterns.fixed @@ -7,7 +7,7 @@ clippy::match_ref_pats, clippy::upper_case_acronyms, clippy::needless_if, - clippy::manual_range_pattern + clippy::manual_range_patterns )] #![allow(unreachable_patterns, irrefutable_let_patterns, unused)] diff --git a/tests/ui/unnested_or_patterns.rs b/tests/ui/unnested_or_patterns.rs index a09c3c66090..9e0e7b5def9 100644 --- a/tests/ui/unnested_or_patterns.rs +++ b/tests/ui/unnested_or_patterns.rs @@ -7,7 +7,7 @@ clippy::match_ref_pats, clippy::upper_case_acronyms, clippy::needless_if, - clippy::manual_range_pattern + clippy::manual_range_patterns )] #![allow(unreachable_patterns, irrefutable_let_patterns, unused)] diff --git a/tests/ui/unnested_or_patterns2.fixed b/tests/ui/unnested_or_patterns2.fixed index ebaba019cfd..11dc3437875 100644 --- a/tests/ui/unnested_or_patterns2.fixed +++ b/tests/ui/unnested_or_patterns2.fixed @@ -6,7 +6,7 @@ clippy::cognitive_complexity, clippy::match_ref_pats, clippy::needless_if, - clippy::manual_range_pattern + clippy::manual_range_patterns )] #![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)] diff --git a/tests/ui/unnested_or_patterns2.rs b/tests/ui/unnested_or_patterns2.rs index 50b6ca585cf..b2556082741 100644 --- a/tests/ui/unnested_or_patterns2.rs +++ b/tests/ui/unnested_or_patterns2.rs @@ -6,7 +6,7 @@ clippy::cognitive_complexity, clippy::match_ref_pats, clippy::needless_if, - clippy::manual_range_pattern + clippy::manual_range_patterns )] #![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)]