]>
Commit | Line | Data |
---|---|---|
dfeec247 | 1 | error[E0317]: `if` may be missing an `else` clause |
532ac7d7 XL |
2 | --> $DIR/if-without-else-as-fn-expr.rs:2:5 |
3 | | | |
4 | LL | fn foo(bar: usize) -> usize { | |
5 | | ----- expected `usize` because of this return type | |
6 | LL | / if bar % 5 == 0 { | |
7 | LL | | return 3; | |
8 | LL | | } | |
60c5eb7d | 9 | | |_____^ expected `usize`, found `()` |
532ac7d7 | 10 | | |
532ac7d7 XL |
11 | = note: `if` expressions without `else` evaluate to `()` |
12 | = help: consider adding an `else` block that evaluates to the expected type | |
13 | ||
dfeec247 | 14 | error[E0317]: `if` may be missing an `else` clause |
e1599b0c | 15 | --> $DIR/if-without-else-as-fn-expr.rs:9:20 |
532ac7d7 XL |
16 | | |
17 | LL | let x: usize = if bar % 5 == 0 { | |
18 | | _________-__________^ | |
19 | | | | | |
20 | | | expected because of this assignment | |
21 | LL | | return 3; | |
22 | LL | | }; | |
60c5eb7d | 23 | | |_____^ expected `usize`, found `()` |
532ac7d7 | 24 | | |
532ac7d7 XL |
25 | = note: `if` expressions without `else` evaluate to `()` |
26 | = help: consider adding an `else` block that evaluates to the expected type | |
27 | ||
dfeec247 | 28 | error[E0317]: `if` may be missing an `else` clause |
e1599b0c | 29 | --> $DIR/if-without-else-as-fn-expr.rs:17:5 |
532ac7d7 XL |
30 | | |
31 | LL | fn foo3(bar: usize) -> usize { | |
32 | | ----- expected `usize` because of this return type | |
33 | LL | / if bar % 5 == 0 { | |
34 | LL | | 3 | |
35 | LL | | } | |
60c5eb7d | 36 | | |_____^ expected `usize`, found `()` |
532ac7d7 | 37 | | |
532ac7d7 XL |
38 | = note: `if` expressions without `else` evaluate to `()` |
39 | = help: consider adding an `else` block that evaluates to the expected type | |
40 | ||
dfeec247 | 41 | error[E0317]: `if` may be missing an `else` clause |
e1599b0c | 42 | --> $DIR/if-without-else-as-fn-expr.rs:24:5 |
48663c56 XL |
43 | | |
44 | LL | fn foo_let(bar: usize) -> usize { | |
45 | | ----- expected `usize` because of this return type | |
46 | LL | / if let 0 = 1 { | |
47 | LL | | return 3; | |
48 | LL | | } | |
60c5eb7d | 49 | | |_____^ expected `usize`, found `()` |
48663c56 | 50 | | |
48663c56 XL |
51 | = note: `if` expressions without `else` evaluate to `()` |
52 | = help: consider adding an `else` block that evaluates to the expected type | |
53 | ||
dfeec247 | 54 | error[E0317]: `if` may be missing an `else` clause |
e1599b0c | 55 | --> $DIR/if-without-else-as-fn-expr.rs:31:20 |
48663c56 XL |
56 | | |
57 | LL | let x: usize = if let 0 = 1 { | |
58 | | _________-__________^ | |
59 | | | | | |
60 | | | expected because of this assignment | |
61 | LL | | return 3; | |
62 | LL | | }; | |
60c5eb7d | 63 | | |_____^ expected `usize`, found `()` |
48663c56 | 64 | | |
48663c56 XL |
65 | = note: `if` expressions without `else` evaluate to `()` |
66 | = help: consider adding an `else` block that evaluates to the expected type | |
67 | ||
dfeec247 | 68 | error[E0317]: `if` may be missing an `else` clause |
e1599b0c | 69 | --> $DIR/if-without-else-as-fn-expr.rs:39:5 |
48663c56 XL |
70 | | |
71 | LL | fn foo3_let(bar: usize) -> usize { | |
72 | | ----- expected `usize` because of this return type | |
73 | LL | / if let 0 = 1 { | |
74 | LL | | 3 | |
75 | LL | | } | |
60c5eb7d | 76 | | |_____^ expected `usize`, found `()` |
48663c56 | 77 | | |
48663c56 XL |
78 | = note: `if` expressions without `else` evaluate to `()` |
79 | = help: consider adding an `else` block that evaluates to the expected type | |
80 | ||
e1599b0c | 81 | error: aborting due to 6 previous errors |
532ac7d7 | 82 | |
e1599b0c | 83 | For more information about this error, try `rustc --explain E0317`. |