rust-clippy/tests/ui/blocks_in_conditions.stderr

58 lines
1.5 KiB
Text
Raw Normal View History

2020-01-06 06:36:33 +00:00
error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> tests/ui/blocks_in_conditions.rs:30:5
|
LL | / if {
LL | |
2018-12-27 15:57:55 +00:00
LL | | let x = 3;
LL | | x == 3
LL | | } {
| |_____^
|
= note: `-D clippy::blocks-in-conditions` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::blocks_in_conditions)]`
help: try
|
2021-08-11 14:21:33 +00:00
LL ~ let res = {
LL +
2021-08-11 14:21:33 +00:00
LL + let x = 3;
LL + x == 3
LL ~ }; if res {
|
error: omit braces around single expression condition
--> tests/ui/blocks_in_conditions.rs:42:8
|
LL | if { true } { 6 } else { 10 }
| ^^^^^^^^ help: try: `true`
error: this boolean expression can be simplified
--> tests/ui/blocks_in_conditions.rs:48:8
|
LL | if true && x == 3 { 6 } else { 10 }
2017-07-21 08:40:23 +00:00
| ^^^^^^^^^^^^^^ help: try: `x == 3`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
error: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> tests/ui/blocks_in_conditions.rs:75:5
|
LL | / match {
LL | |
LL | | let opt = Some(2);
LL | | opt
LL | | } {
| |_____^
|
help: try
|
LL ~ let res = {
LL +
LL + let opt = Some(2);
LL + opt
LL ~ }; match res {
|
error: aborting due to 4 previous errors
2018-01-16 16:06:27 +00:00