From cc87dc753987c580d05cdc24ef06d7d0ac43ced2 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Sun, 26 Aug 2018 10:57:04 +0200 Subject: [PATCH] Move some range lints to complexity Recategorize `range_plus_one` and `range_minus_one` to `complexity`. This moves `range_plus_one` out of the nursery as the inclusive range syntax is now stable. Both are moved to `complexity` as it is more consistent with other lints such as `int_plus_one`. --- clippy_lints/src/lib.rs | 5 +++-- clippy_lints/src/ranges.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index da6db4cfe45d..af87655e65c7 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -635,6 +635,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { question_mark::QUESTION_MARK, ranges::ITERATOR_STEP_BY_ZERO, ranges::RANGE_MINUS_ONE, + ranges::RANGE_PLUS_ONE, ranges::RANGE_ZIP_WITH_LEN, redundant_field_names::REDUNDANT_FIELD_NAMES, reference::DEREF_ADDROF, @@ -756,7 +757,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { ptr::CMP_NULL, ptr::PTR_ARG, question_mark::QUESTION_MARK, - ranges::RANGE_MINUS_ONE, redundant_field_names::REDUNDANT_FIELD_NAMES, regex::REGEX_MACRO, regex::TRIVIAL_REGEX, @@ -816,6 +816,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL, partialeq_ne_impl::PARTIALEQ_NE_IMPL, precedence::PRECEDENCE, + ranges::RANGE_MINUS_ONE, + ranges::RANGE_PLUS_ONE, ranges::RANGE_ZIP_WITH_LEN, reference::DEREF_ADDROF, reference::REF_IN_DEREF, @@ -921,7 +923,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { fallible_impl_from::FALLIBLE_IMPL_FROM, mutex_atomic::MUTEX_INTEGER, needless_borrow::NEEDLESS_BORROW, - ranges::RANGE_PLUS_ONE, unwrap::PANICKING_UNWRAP, unwrap::UNNECESSARY_UNWRAP, ]); diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index 27620ede5b0c..ba25e50d7c01 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -57,7 +57,7 @@ declare_clippy_lint! { /// ``` declare_clippy_lint! { pub RANGE_PLUS_ONE, - nursery, + complexity, "`x..(y+1)` reads better as `x..=y`" } @@ -75,7 +75,7 @@ declare_clippy_lint! { /// ``` declare_clippy_lint! { pub RANGE_MINUS_ONE, - style, + complexity, "`x..=(y-1)` reads better as `x..y`" }