Closed
Description
clippy version:
clippy 0.0.212 (1b89724 2019-01-15)
clippy 0.0.212 (caccf8b 2019-03-03)
code:
│ File: src/main.rs
───────┼────────────────────────────────────────────────────────────────────────────────
1 │ const THRESHOLD: u32 = 1_000;
2 │
3 │ fn clippy_test(a: u32, b: u32) -> bool {
4 │ if a < THRESHOLD && b >= THRESHOLD || a >= THRESHOLD && b < THRESHOLD {
5 │ return false;
6 │ }
7 │ true
8 │ }
9 │
10 │ fn main() {
11 │ assert_eq!(clippy_test(100, 200), true);
12 │ assert_eq!(clippy_test(1_100, 900), false);
13 │ }
warning:
clippy-test-demo git:(master) ✗ cargo clippy
Checking clippy-test-demo v0.1.0 (/home/koushiro/Code/clippy-test-demo)
warning: this boolean expression can be simplified
--> src/main.rs:4:8
|
4 | if a < THRESHOLD && b >= THRESHOLD || a >= THRESHOLD && b < THRESHOLD {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try: `a < THRESHOLD && b >= THRESHOLD || a >= THRESHOLD && b < THRESHOLD`
|
= note: #[warn(clippy::nonminimal_bool)] on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/
master/index.html#nonminimal_bool
Finished dev [unoptimized + debuginfo] target(s) in 0.42s