1 error[E0317]: if may be missing an else clause
2 --> $DIR/if-without-else-as-fn-expr.rs:2:5
4 LL | fn foo(bar: usize) -> usize {
5 | ----- expected `usize` because of this return type
6 LL | / if bar % 5 == 0 {
9 | |_____^ expected usize, found ()
11 = note: expected type `usize`
13 = note: `if` expressions without `else` evaluate to `()`
14 = help: consider adding an `else` block that evaluates to the expected type
16 error[E0317]: if may be missing an else clause
17 --> $DIR/if-without-else-as-fn-expr.rs:9:20
19 LL | let x: usize = if bar % 5 == 0 {
20 | _________-__________^
22 | | expected because of this assignment
25 | |_____^ expected usize, found ()
27 = note: expected type `usize`
29 = note: `if` expressions without `else` evaluate to `()`
30 = help: consider adding an `else` block that evaluates to the expected type
32 error[E0317]: if may be missing an else clause
33 --> $DIR/if-without-else-as-fn-expr.rs:17:5
35 LL | fn foo3(bar: usize) -> usize {
36 | ----- expected `usize` because of this return type
37 LL | / if bar % 5 == 0 {
40 | |_____^ expected usize, found ()
42 = note: expected type `usize`
44 = note: `if` expressions without `else` evaluate to `()`
45 = help: consider adding an `else` block that evaluates to the expected type
47 error[E0317]: if may be missing an else clause
48 --> $DIR/if-without-else-as-fn-expr.rs:24:5
50 LL | fn foo_let(bar: usize) -> usize {
51 | ----- expected `usize` because of this return type
55 | |_____^ expected usize, found ()
57 = note: expected type `usize`
59 = note: `if` expressions without `else` evaluate to `()`
60 = help: consider adding an `else` block that evaluates to the expected type
62 error[E0317]: if may be missing an else clause
63 --> $DIR/if-without-else-as-fn-expr.rs:31:20
65 LL | let x: usize = if let 0 = 1 {
66 | _________-__________^
68 | | expected because of this assignment
71 | |_____^ expected usize, found ()
73 = note: expected type `usize`
75 = note: `if` expressions without `else` evaluate to `()`
76 = help: consider adding an `else` block that evaluates to the expected type
78 error[E0317]: if may be missing an else clause
79 --> $DIR/if-without-else-as-fn-expr.rs:39:5
81 LL | fn foo3_let(bar: usize) -> usize {
82 | ----- expected `usize` because of this return type
86 | |_____^ expected usize, found ()
88 = note: expected type `usize`
90 = note: `if` expressions without `else` evaluate to `()`
91 = help: consider adding an `else` block that evaluates to the expected type
93 error: aborting due to 6 previous errors
95 For more information about this error, try `rustc --explain E0317`.