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: aborting due to 3 previous errors
49 For more information about this error, try `rustc --explain E0317`.