mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
123 lines
2.8 KiB
Text
123 lines
2.8 KiB
Text
error: this boolean expression can be simplified
|
|
--> tests/ui/match_bool.rs:36:11
|
|
|
|
|
LL | match test && test {
|
|
| ^^^^^^^^^^^^ help: try: `test`
|
|
|
|
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
|
|
|
|
error: you seem to be trying to match on a boolean expression
|
|
--> tests/ui/match_bool.rs:7:5
|
|
|
|
|
LL | / match test {
|
|
LL | |
|
|
LL | | true => 0,
|
|
LL | | false => 42,
|
|
LL | | };
|
|
| |_____^ help: consider using an `if`/`else` expression: `if test { 0 } else { 42 }`
|
|
|
|
|
note: the lint level is defined here
|
|
--> tests/ui/match_bool.rs:2:9
|
|
|
|
|
LL | #![deny(clippy::match_bool)]
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
error: you seem to be trying to match on a boolean expression
|
|
--> tests/ui/match_bool.rs:14:5
|
|
|
|
|
LL | / match option == 1 {
|
|
LL | |
|
|
LL | | true => 1,
|
|
LL | | false => 0,
|
|
LL | | };
|
|
| |_____^ help: consider using an `if`/`else` expression: `if option == 1 { 1 } else { 0 }`
|
|
|
|
error: you seem to be trying to match on a boolean expression
|
|
--> tests/ui/match_bool.rs:20:5
|
|
|
|
|
LL | / match test {
|
|
LL | |
|
|
LL | | true => (),
|
|
LL | | false => {
|
|
LL | | println!("Noooo!");
|
|
LL | | },
|
|
LL | | };
|
|
| |_____^
|
|
|
|
|
help: consider using an `if`/`else` expression
|
|
|
|
|
LL ~ if !test {
|
|
LL + println!("Noooo!");
|
|
LL ~ };
|
|
|
|
|
|
|
error: you seem to be trying to match on a boolean expression
|
|
--> tests/ui/match_bool.rs:28:5
|
|
|
|
|
LL | / match test {
|
|
LL | |
|
|
LL | | false => {
|
|
LL | | println!("Noooo!");
|
|
LL | | },
|
|
LL | | _ => (),
|
|
LL | | };
|
|
| |_____^
|
|
|
|
|
help: consider using an `if`/`else` expression
|
|
|
|
|
LL ~ if !test {
|
|
LL + println!("Noooo!");
|
|
LL ~ };
|
|
|
|
|
|
|
error: you seem to be trying to match on a boolean expression
|
|
--> tests/ui/match_bool.rs:36:5
|
|
|
|
|
LL | / match test && test {
|
|
LL | |
|
|
LL | |
|
|
LL | |
|
|
... |
|
|
LL | | _ => (),
|
|
LL | | };
|
|
| |_____^
|
|
|
|
|
help: consider using an `if`/`else` expression
|
|
|
|
|
LL ~ if !(test && test) {
|
|
LL + println!("Noooo!");
|
|
LL ~ };
|
|
|
|
|
|
|
error: equal expressions as operands to `&&`
|
|
--> tests/ui/match_bool.rs:36:11
|
|
|
|
|
LL | match test && test {
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
= note: `#[deny(clippy::eq_op)]` on by default
|
|
|
|
error: you seem to be trying to match on a boolean expression
|
|
--> tests/ui/match_bool.rs:48:5
|
|
|
|
|
LL | / match test {
|
|
LL | |
|
|
LL | | false => {
|
|
LL | | println!("Noooo!");
|
|
... |
|
|
LL | | },
|
|
LL | | };
|
|
| |_____^
|
|
|
|
|
help: consider using an `if`/`else` expression
|
|
|
|
|
LL ~ if test {
|
|
LL + println!("Yes!");
|
|
LL + } else {
|
|
LL + println!("Noooo!");
|
|
LL ~ };
|
|
|
|
|
|
|
error: aborting due to 8 previous errors
|
|
|