Skip to content

Commit

Permalink
Merge pull request #861 from birkenfeld/issue859
Browse files Browse the repository at this point in the history
Make if_not_else lint Allow by default (fixes #859)
  • Loading branch information
mcarton committed Apr 17, 2016
2 parents 63404ff + 12b8a0a commit b433327
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/if_not_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/entry.rs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(plugin)]
#![plugin(clippy)]
#![allow(unused, if_not_else)]
#![allow(unused)]

#![deny(map_entry)]

Expand Down
1 change: 1 addition & 0 deletions tests/compile-fail/if_not_else.rs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![feature(plugin)]
#![plugin(clippy)]
#![deny(clippy)]
#![deny(if_not_else)]

fn bla() -> bool { unimplemented!() }

Expand Down

0 comments on commit b433327

Please sign in to comment.