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:
Georg Brandl 2017-05-26 09:20:03 +02:00
parent 06472ca651
commit 3ba4e8b3fa
3 changed files with 9 additions and 6 deletions

View file

@ -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_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
[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_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

View file

@ -324,6 +324,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
enum_variants::STUTTER,
if_not_else::IF_NOT_ELSE,
items_after_statements::ITEMS_AFTER_STATEMENTS,
loops::NEVER_LOOP,
matches::SINGLE_MATCH_ELSE,
mem_forget::MEM_FORGET,
methods::FILTER_MAP,
@ -419,7 +420,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
loops::FOR_LOOP_OVER_RESULT,
loops::ITER_NEXT_LOOP,
loops::NEEDLESS_RANGE_LOOP,
loops::NEVER_LOOP,
loops::REVERSE_RANGE_LOOP,
loops::UNUSED_COLLECT,
loops::WHILE_LET_LOOP,

View file

@ -285,12 +285,15 @@ declare_lint! {
"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
/// 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:**
/// ```rust
@ -298,8 +301,8 @@ declare_lint! {
/// ```
declare_lint! {
pub NEVER_LOOP,
Warn,
"any loop with an unconditional `break` statement"
Allow,
"any loop with an unconditional `break` or `return` statement"
}
#[derive(Copy, Clone)]