mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-09 00:17:44 +00:00
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:
commit
7ae24429ab
@ -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_continue::NEEDLESS_CONTINUE),
|
||||||
LintId::of(&needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
|
LintId::of(&needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
|
||||||
LintId::of(&non_expressive_names::SIMILAR_NAMES),
|
LintId::of(&non_expressive_names::SIMILAR_NAMES),
|
||||||
|
LintId::of(&ranges::RANGE_PLUS_ONE),
|
||||||
LintId::of(&replace_consts::REPLACE_CONSTS),
|
LintId::of(&replace_consts::REPLACE_CONSTS),
|
||||||
LintId::of(&shadow::SHADOW_UNRELATED),
|
LintId::of(&shadow::SHADOW_UNRELATED),
|
||||||
LintId::of(&strings::STRING_ADD_ASSIGN),
|
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(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
|
||||||
LintId::of(&question_mark::QUESTION_MARK),
|
LintId::of(&question_mark::QUESTION_MARK),
|
||||||
LintId::of(&ranges::RANGE_MINUS_ONE),
|
LintId::of(&ranges::RANGE_MINUS_ONE),
|
||||||
LintId::of(&ranges::RANGE_PLUS_ONE),
|
|
||||||
LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
|
LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
|
||||||
LintId::of(&redundant_clone::REDUNDANT_CLONE),
|
LintId::of(&redundant_clone::REDUNDANT_CLONE),
|
||||||
LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
|
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(&precedence::PRECEDENCE),
|
||||||
LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
|
LintId::of(&ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
|
||||||
LintId::of(&ranges::RANGE_MINUS_ONE),
|
LintId::of(&ranges::RANGE_MINUS_ONE),
|
||||||
LintId::of(&ranges::RANGE_PLUS_ONE),
|
|
||||||
LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
|
LintId::of(&ranges::RANGE_ZIP_WITH_LEN),
|
||||||
LintId::of(&reference::DEREF_ADDROF),
|
LintId::of(&reference::DEREF_ADDROF),
|
||||||
LintId::of(&reference::REF_IN_DEREF),
|
LintId::of(&reference::REF_IN_DEREF),
|
||||||
|
@ -45,6 +45,10 @@ declare_clippy_lint! {
|
|||||||
/// and ends with a closing one.
|
/// and ends with a closing one.
|
||||||
/// I.e., `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..=f())`.
|
/// 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:**
|
/// **Example:**
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// for x..(y+1) { .. }
|
/// for x..(y+1) { .. }
|
||||||
@ -54,7 +58,7 @@ declare_clippy_lint! {
|
|||||||
/// for x..=y { .. }
|
/// for x..=y { .. }
|
||||||
/// ```
|
/// ```
|
||||||
pub RANGE_PLUS_ONE,
|
pub RANGE_PLUS_ONE,
|
||||||
complexity,
|
pedantic,
|
||||||
"`x..(y+1)` reads better as `x..=y`"
|
"`x..(y+1)` reads better as `x..=y`"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1654,7 +1654,7 @@ pub const ALL_LINTS: [Lint; 347] = [
|
|||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
name: "range_plus_one",
|
name: "range_plus_one",
|
||||||
group: "complexity",
|
group: "pedantic",
|
||||||
desc: "`x..(y+1)` reads better as `x..=y`",
|
desc: "`x..(y+1)` reads better as `x..=y`",
|
||||||
deprecation: None,
|
deprecation: None,
|
||||||
module: "ranges",
|
module: "ranges",
|
||||||
|
Loading…
Reference in New Issue
Block a user