Skip to content

Commit 7ae2442

Browse files
committed
Auto merge of #5057 - rust-lang:pedantic_range_plus_one, r=flip1995
Downgrade range_plus_one to pedantic This fixes #2217 changelog: Downgrade [`range_plus_one`] to `pedantic`
2 parents e36a33f + ff5fb19 commit 7ae2442

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

clippy_lints/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10681068
LintId::of(&needless_continue::NEEDLESS_CONTINUE),
10691069
LintId::of(&needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
10701070
LintId::of(&non_expressive_names::SIMILAR_NAMES),
1071+
LintId::of(&ranges::RANGE_PLUS_ONE),
10711072
LintId::of(&replace_consts::REPLACE_CONSTS),
10721073
LintId::of(&shadow::SHADOW_UNRELATED),
10731074
LintId::of(&strings::STRING_ADD_ASSIGN),
@@ -1277,7 +1278,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12771278
LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
12781279
LintId::of(&question_mark::QUESTION_MARK),
12791280
LintId::of(&ranges::RANGE_MINUS_ONE),
1280-
LintId::of(&ranges::RANGE_PLUS_ONE),
12811281
LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
12821282
LintId::of(&redundant_clone::REDUNDANT_CLONE),
12831283
LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
@@ -1495,7 +1495,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14951495
LintId::of(&precedence::PRECEDENCE),
14961496
LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
14971497
LintId::of(&ranges::RANGE_MINUS_ONE),
1498-
LintId::of(&ranges::RANGE_PLUS_ONE),
14991498
LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
15001499
LintId::of(&reference::DEREF_ADDROF),
15011500
LintId::of(&reference::REF_IN_DEREF),

clippy_lints/src/ranges.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ declare_clippy_lint! {
4545
/// and ends with a closing one.
4646
/// I.e., `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..=f())`.
4747
///
48+
/// Also in many cases, inclusive ranges are still slower to run than
49+
/// exclusive ranges, because they essentially add an extra branch that
50+
/// LLVM may fail to hoist out of the loop.
51+
///
4852
/// **Example:**
4953
/// ```rust,ignore
5054
/// for x..(y+1) { .. }
@@ -54,7 +58,7 @@ declare_clippy_lint! {
5458
/// for x..=y { .. }
5559
/// ```
5660
pub RANGE_PLUS_ONE,
57-
complexity,
61+
pedantic,
5862
"`x..(y+1)` reads better as `x..=y`"
5963
}
6064

src/lintlist/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ pub const ALL_LINTS: [Lint; 347] = [
16541654
},
16551655
Lint {
16561656
name: "range_plus_one",
1657-
group: "complexity",
1657+
group: "pedantic",
16581658
desc: "`x..(y+1)` reads better as `x..=y`",
16591659
deprecation: None,
16601660
module: "ranges",

0 commit comments

Comments
 (0)