Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lint comparison to bool (e.g.
y == true
)
Addresses #630
- Loading branch information
Joshua Holmer
committed
Feb 9, 2016
1 parent
8c886f1
commit 56b3e7b
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![feature(plugin)] | ||
#![plugin(clippy)] | ||
|
||
#[allow(needless_bool)] | ||
#[deny(bool_comparison)] | ||
fn main() { | ||
let x = true; | ||
if x == true { true } else { false }; //~ERROR you can simplify this boolean comparison to `x` | ||
if x == false { true } else { false }; //~ERROR you can simplify this boolean comparison to `!x` | ||
if true == x { true } else { false }; //~ERROR you can simplify this boolean comparison to `x` | ||
if false == x { true } else { false }; //~ERROR you can simplify this boolean comparison to `!x` | ||
} |