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`
This commit is contained in:
bors 2020-01-18 10:23:46 +00:00
commit 7ae24429ab
3 changed files with 7 additions and 4 deletions

View file

@ -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),

View file

@ -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`"
}

View file

@ -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",