mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-22 20:53:21 +00:00
Demote the never_loop lint to Allow for now.
Also add "known problem" to the description, with link to #1586.
This commit is contained in:
parent
06472ca651
commit
3ba4e8b3fa
3 changed files with 9 additions and 6 deletions
|
@ -295,7 +295,7 @@ name
|
||||||
[needless_return](https://github.com/Manishearth/rust-clippy/wiki#needless_return) | warn | using a return statement like `return expr;` where an expression would suffice
|
[needless_return](https://github.com/Manishearth/rust-clippy/wiki#needless_return) | warn | using a return statement like `return expr;` where an expression would suffice
|
||||||
[needless_update](https://github.com/Manishearth/rust-clippy/wiki#needless_update) | warn | using `Foo { ..base }` when there are no missing fields
|
[needless_update](https://github.com/Manishearth/rust-clippy/wiki#needless_update) | warn | using `Foo { ..base }` when there are no missing fields
|
||||||
[neg_multiply](https://github.com/Manishearth/rust-clippy/wiki#neg_multiply) | warn | multiplying integers with -1
|
[neg_multiply](https://github.com/Manishearth/rust-clippy/wiki#neg_multiply) | warn | multiplying integers with -1
|
||||||
[never_loop](https://github.com/Manishearth/rust-clippy/wiki#never_loop) | warn | any loop with an unconditional `break` statement
|
[never_loop](https://github.com/Manishearth/rust-clippy/wiki#never_loop) | allow | any loop with an unconditional `break` or `return` statement
|
||||||
[new_ret_no_self](https://github.com/Manishearth/rust-clippy/wiki#new_ret_no_self) | warn | not returning `Self` in a `new` method
|
[new_ret_no_self](https://github.com/Manishearth/rust-clippy/wiki#new_ret_no_self) | warn | not returning `Self` in a `new` method
|
||||||
[new_without_default](https://github.com/Manishearth/rust-clippy/wiki#new_without_default) | warn | `fn new() -> Self` method without `Default` implementation
|
[new_without_default](https://github.com/Manishearth/rust-clippy/wiki#new_without_default) | warn | `fn new() -> Self` method without `Default` implementation
|
||||||
[new_without_default_derive](https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive) | warn | `fn new() -> Self` without `#[derive]`able `Default` implementation
|
[new_without_default_derive](https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive) | warn | `fn new() -> Self` without `#[derive]`able `Default` implementation
|
||||||
|
|
|
@ -324,6 +324,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||||
enum_variants::STUTTER,
|
enum_variants::STUTTER,
|
||||||
if_not_else::IF_NOT_ELSE,
|
if_not_else::IF_NOT_ELSE,
|
||||||
items_after_statements::ITEMS_AFTER_STATEMENTS,
|
items_after_statements::ITEMS_AFTER_STATEMENTS,
|
||||||
|
loops::NEVER_LOOP,
|
||||||
matches::SINGLE_MATCH_ELSE,
|
matches::SINGLE_MATCH_ELSE,
|
||||||
mem_forget::MEM_FORGET,
|
mem_forget::MEM_FORGET,
|
||||||
methods::FILTER_MAP,
|
methods::FILTER_MAP,
|
||||||
|
@ -419,7 +420,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||||
loops::FOR_LOOP_OVER_RESULT,
|
loops::FOR_LOOP_OVER_RESULT,
|
||||||
loops::ITER_NEXT_LOOP,
|
loops::ITER_NEXT_LOOP,
|
||||||
loops::NEEDLESS_RANGE_LOOP,
|
loops::NEEDLESS_RANGE_LOOP,
|
||||||
loops::NEVER_LOOP,
|
|
||||||
loops::REVERSE_RANGE_LOOP,
|
loops::REVERSE_RANGE_LOOP,
|
||||||
loops::UNUSED_COLLECT,
|
loops::UNUSED_COLLECT,
|
||||||
loops::WHILE_LET_LOOP,
|
loops::WHILE_LET_LOOP,
|
||||||
|
|
|
@ -285,12 +285,15 @@ declare_lint! {
|
||||||
"looping on a map using `iter` when `keys` or `values` would do"
|
"looping on a map using `iter` when `keys` or `values` would do"
|
||||||
}
|
}
|
||||||
|
|
||||||
/// **What it does:** Checks for loops that contain an unconditional `break`.
|
/// **What it does:** Checks for loops that contain an unconditional `break`
|
||||||
|
/// or `return`.
|
||||||
///
|
///
|
||||||
/// **Why is this bad?** This loop never loops, all it does is obfuscating the
|
/// **Why is this bad?** This loop never loops, all it does is obfuscating the
|
||||||
/// code.
|
/// code.
|
||||||
///
|
///
|
||||||
/// **Known problems:** None.
|
/// **Known problems:** Ignores `continue` statements in the loop that create
|
||||||
|
/// nontrivial control flow. Therefore set to `Allow` by default.
|
||||||
|
/// See https://github.com/Manishearth/rust-clippy/issues/1586
|
||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
@ -298,8 +301,8 @@ declare_lint! {
|
||||||
/// ```
|
/// ```
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
pub NEVER_LOOP,
|
pub NEVER_LOOP,
|
||||||
Warn,
|
Allow,
|
||||||
"any loop with an unconditional `break` statement"
|
"any loop with an unconditional `break` or `return` statement"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
|
|
Loading…
Reference in a new issue