]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | error: `if _ { .. } else { .. }` is an expression |
2 | --> $DIR/let_if_seq.rs:64:5 | |
3 | | | |
4 | LL | / let mut foo = 0; | |
5 | LL | | if f() { | |
6 | LL | | foo = 42; | |
7 | LL | | } | |
8 | | |_____^ help: it is more idiomatic to write: `let <mut> foo = if f() { 42 } else { 0 };` | |
9 | | | |
10 | = note: `-D clippy::useless-let-if-seq` implied by `-D warnings` | |
11 | = note: you might not need `mut` at all | |
12 | ||
13 | error: `if _ { .. } else { .. }` is an expression | |
14 | --> $DIR/let_if_seq.rs:69:5 | |
15 | | | |
16 | LL | / let mut bar = 0; | |
17 | LL | | if f() { | |
18 | LL | | f(); | |
19 | LL | | bar = 42; | |
20 | LL | | } else { | |
21 | LL | | f(); | |
22 | LL | | } | |
23 | | |_____^ help: it is more idiomatic to write: `let <mut> bar = if f() { ..; 42 } else { ..; 0 };` | |
24 | | | |
25 | = note: you might not need `mut` at all | |
26 | ||
27 | error: `if _ { .. } else { .. }` is an expression | |
28 | --> $DIR/let_if_seq.rs:77:5 | |
29 | | | |
30 | LL | / let quz; | |
31 | LL | | if f() { | |
32 | LL | | quz = 42; | |
33 | LL | | } else { | |
34 | LL | | quz = 0; | |
35 | LL | | } | |
36 | | |_____^ help: it is more idiomatic to write: `let quz = if f() { 42 } else { 0 };` | |
37 | ||
38 | error: `if _ { .. } else { .. }` is an expression | |
39 | --> $DIR/let_if_seq.rs:106:5 | |
40 | | | |
41 | LL | / let mut baz = 0; | |
42 | LL | | if f() { | |
43 | LL | | baz = 42; | |
44 | LL | | } | |
45 | | |_____^ help: it is more idiomatic to write: `let <mut> baz = if f() { 42 } else { 0 };` | |
46 | | | |
47 | = note: you might not need `mut` at all | |
48 | ||
49 | error: aborting due to 4 previous errors | |
50 |