From ff5fb19bbd7f9885c32009957fa7f7e2b42e9e16 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Fri, 17 Jan 2020 10:15:14 +0100 Subject: [PATCH] Downgrade range_plus_one to pedantic --- clippy_lints/src/lib.rs | 3 +-- clippy_lints/src/ranges.rs | 6 +++++- src/lintlist/mod.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index c1fe51fbf8af2..b37e0945d7784 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -1068,6 +1068,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(&needless_continue::NEEDLESS_CONTINUE), LintId::of(&needless_pass_by_value::NEEDLESS_PASS_BY_VALUE), LintId::of(&non_expressive_names::SIMILAR_NAMES), + LintId::of(&ranges::RANGE_PLUS_ONE), LintId::of(&replace_consts::REPLACE_CONSTS), LintId::of(&shadow::SHADOW_UNRELATED), LintId::of(&strings::STRING_ADD_ASSIGN), @@ -1277,7 +1278,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST), LintId::of(&question_mark::QUESTION_MARK), LintId::of(&ranges::RANGE_MINUS_ONE), - LintId::of(&ranges::RANGE_PLUS_ONE), LintId::of(&ranges::RANGE_ZIP_WITH_LEN), LintId::of(&redundant_clone::REDUNDANT_CLONE), LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES), @@ -1495,7 +1495,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(&precedence::PRECEDENCE), LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST), LintId::of(&ranges::RANGE_MINUS_ONE), - LintId::of(&ranges::RANGE_PLUS_ONE), LintId::of(&ranges::RANGE_ZIP_WITH_LEN), LintId::of(&reference::DEREF_ADDROF), LintId::of(&reference::REF_IN_DEREF), diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index 19f88e770aed1..1be5978772134 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -45,6 +45,10 @@ declare_clippy_lint! { /// and ends with a closing one. /// I.e., `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..=f())`. /// + /// Also in many cases, inclusive ranges are still slower to run than + /// exclusive ranges, because they essentially add an extra branch that + /// LLVM may fail to hoist out of the loop. + /// /// **Example:** /// ```rust,ignore /// for x..(y+1) { .. } @@ -54,7 +58,7 @@ declare_clippy_lint! { /// for x..=y { .. } /// ``` pub RANGE_PLUS_ONE, - complexity, + pedantic, "`x..(y+1)` reads better as `x..=y`" } diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs index 9cad1ac786afb..eee16fcd31223 100644 --- a/src/lintlist/mod.rs +++ b/src/lintlist/mod.rs @@ -1654,7 +1654,7 @@ pub const ALL_LINTS: [Lint; 347] = [ }, Lint { name: "range_plus_one", - group: "complexity", + group: "pedantic", desc: "`x..(y+1)` reads better as `x..=y`", deprecation: None, module: "ranges",