]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
1 | error: `if _ { .. } else { .. }` is an expression |
2 | --> $DIR/let_if_seq.rs:57:5 | |
3 | | | |
4 | 57 | / let mut foo = 0; | |
5 | 58 | | if f() { | |
6 | 59 | | foo = 42; | |
7 | 60 | | } | |
8 | | |_____^ help: it is more idiomatic to write: `let <mut> foo = if f() { 42 } else { 0 };` | |
9 | | | |
10 | = note: `-D 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:62:5 | |
15 | | | |
16 | 62 | / let mut bar = 0; | |
17 | 63 | | if f() { | |
18 | 64 | | f(); | |
19 | 65 | | bar = 42; | |
20 | ... | | |
21 | 68 | | f(); | |
22 | 69 | | } | |
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:71:5 | |
29 | | | |
30 | 71 | / let quz; | |
31 | 72 | | if f() { | |
32 | 73 | | quz = 42; | |
33 | 74 | | } else { | |
34 | 75 | | quz = 0; | |
35 | 76 | | } | |
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:100:5 | |
40 | | | |
41 | 100 | / let mut baz = 0; | |
42 | 101 | | if f() { | |
43 | 102 | | baz = 42; | |
44 | 103 | | } | |
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 |