mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Merge pull request #861 from birkenfeld/issue859
Make if_not_else lint Allow by default (fixes #859)
This commit is contained in:
commit
b433327311
5 changed files with 5 additions and 4 deletions
|
@ -61,7 +61,7 @@ name
|
|||
[for_loop_over_option](https://github.com/Manishearth/rust-clippy/wiki#for_loop_over_option) | warn | for-looping over an `Option`, which is more clearly expressed as an `if let`
|
||||
[for_loop_over_result](https://github.com/Manishearth/rust-clippy/wiki#for_loop_over_result) | warn | for-looping over a `Result`, which is more clearly expressed as an `if let`
|
||||
[identity_op](https://github.com/Manishearth/rust-clippy/wiki#identity_op) | warn | using identity operations, e.g. `x + 0` or `y / 1`
|
||||
[if_not_else](https://github.com/Manishearth/rust-clippy/wiki#if_not_else) | warn | finds if branches that could be swapped so no negation operation is necessary on the condition
|
||||
[if_not_else](https://github.com/Manishearth/rust-clippy/wiki#if_not_else) | allow | finds if branches that could be swapped so no negation operation is necessary on the condition
|
||||
[if_same_then_else](https://github.com/Manishearth/rust-clippy/wiki#if_same_then_else) | warn | if with the same *then* and *else* blocks
|
||||
[ifs_same_cond](https://github.com/Manishearth/rust-clippy/wiki#ifs_same_cond) | warn | consecutive `ifs` with the same condition
|
||||
[indexing_slicing](https://github.com/Manishearth/rust-clippy/wiki#indexing_slicing) | allow | indexing/slicing usage
|
||||
|
|
|
@ -14,7 +14,7 @@ use utils::span_help_and_lint;
|
|||
///
|
||||
/// **Example:** if !v.is_empty() { a() } else { b() }
|
||||
declare_lint! {
|
||||
pub IF_NOT_ELSE, Warn,
|
||||
pub IF_NOT_ELSE, Allow,
|
||||
"finds if branches that could be swapped so no negation operation is necessary on the condition"
|
||||
}
|
||||
|
||||
|
|
|
@ -237,6 +237,7 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
|||
array_indexing::INDEXING_SLICING,
|
||||
booleans::NONMINIMAL_BOOL,
|
||||
enum_glob_use::ENUM_GLOB_USE,
|
||||
if_not_else::IF_NOT_ELSE,
|
||||
matches::SINGLE_MATCH_ELSE,
|
||||
methods::OPTION_UNWRAP_USED,
|
||||
methods::RESULT_UNWRAP_USED,
|
||||
|
@ -289,7 +290,6 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
|||
formatting::SUSPICIOUS_ELSE_FORMATTING,
|
||||
functions::TOO_MANY_ARGUMENTS,
|
||||
identity_op::IDENTITY_OP,
|
||||
if_not_else::IF_NOT_ELSE,
|
||||
items_after_statements::ITEMS_AFTER_STATEMENTS,
|
||||
len_zero::LEN_WITHOUT_IS_EMPTY,
|
||||
len_zero::LEN_ZERO,
|
||||
|
|
2
tests/compile-fail/entry.rs
Normal file → Executable file
2
tests/compile-fail/entry.rs
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![allow(unused, if_not_else)]
|
||||
#![allow(unused)]
|
||||
|
||||
#![deny(map_entry)]
|
||||
|
||||
|
|
1
tests/compile-fail/if_not_else.rs
Normal file → Executable file
1
tests/compile-fail/if_not_else.rs
Normal file → Executable file
|
@ -1,6 +1,7 @@
|
|||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
#![deny(clippy)]
|
||||
#![deny(if_not_else)]
|
||||
|
||||
fn bla() -> bool { unimplemented!() }
|
||||
|
||||
|
|
Loading…
Reference in a new issue