1 error[E0308]: mismatched types
2 --> $DIR/if-without-else-as-fn-expr.rs:2:5
4 LL | / if bar % 5 == 0 {
7 | |_____^ expected usize, found ()
9 = note: expected type `usize`
12 error[E0317]: if may be missing an else clause
13 --> $DIR/if-without-else-as-fn-expr.rs:2:5
15 LL | fn foo(bar: usize) -> usize {
16 | ----- expected `usize` because of this return type
17 LL | / if bar % 5 == 0 {
20 | |_____^ expected usize, found ()
22 = note: expected type `usize`
24 = note: `if` expressions without `else` evaluate to `()`
25 = help: consider adding an `else` block that evaluates to the expected type
27 error[E0308]: mismatched types
28 --> $DIR/if-without-else-as-fn-expr.rs:10:20
30 LL | let x: usize = if bar % 5 == 0 {
31 | ____________________^
34 | |_____^ expected usize, found ()
36 = note: expected type `usize`
39 error[E0317]: if may be missing an else clause
40 --> $DIR/if-without-else-as-fn-expr.rs:10:20
42 LL | let x: usize = if bar % 5 == 0 {
43 | _________-__________^
45 | | expected because of this assignment
48 | |_____^ expected usize, found ()
50 = note: expected type `usize`
52 = note: `if` expressions without `else` evaluate to `()`
53 = help: consider adding an `else` block that evaluates to the expected type
55 error[E0308]: mismatched types
56 --> $DIR/if-without-else-as-fn-expr.rs:19:5
58 LL | / if bar % 5 == 0 {
61 | |_____^ expected usize, found ()
63 = note: expected type `usize`
66 error[E0317]: if may be missing an else clause
67 --> $DIR/if-without-else-as-fn-expr.rs:19:5
69 LL | fn foo3(bar: usize) -> usize {
70 | ----- expected `usize` because of this return type
71 LL | / if bar % 5 == 0 {
74 | |_____^ expected usize, found ()
76 = note: expected type `usize`
78 = note: `if` expressions without `else` evaluate to `()`
79 = help: consider adding an `else` block that evaluates to the expected type
81 error[E0308]: mismatched types
82 --> $DIR/if-without-else-as-fn-expr.rs:27:5
87 | |_____^ expected usize, found ()
89 = note: expected type `usize`
92 error[E0317]: if may be missing an else clause
93 --> $DIR/if-without-else-as-fn-expr.rs:27:5
95 LL | fn foo_let(bar: usize) -> usize {
96 | ----- expected `usize` because of this return type
100 | |_____^ expected usize, found ()
102 = note: expected type `usize`
104 = note: `if` expressions without `else` evaluate to `()`
105 = help: consider adding an `else` block that evaluates to the expected type
107 error[E0308]: mismatched types
108 --> $DIR/if-without-else-as-fn-expr.rs:35:20
110 LL | let x: usize = if let 0 = 1 {
111 | ____________________^
114 | |_____^ expected usize, found ()
116 = note: expected type `usize`
119 error[E0317]: if may be missing an else clause
120 --> $DIR/if-without-else-as-fn-expr.rs:35:20
122 LL | let x: usize = if let 0 = 1 {
123 | _________-__________^
125 | | expected because of this assignment
128 | |_____^ expected usize, found ()
130 = note: expected type `usize`
132 = note: `if` expressions without `else` evaluate to `()`
133 = help: consider adding an `else` block that evaluates to the expected type
135 error[E0308]: mismatched types
136 --> $DIR/if-without-else-as-fn-expr.rs:44:5
138 LL | / if let 0 = 1 {
141 | |_____^ expected usize, found ()
143 = note: expected type `usize`
146 error[E0317]: if may be missing an else clause
147 --> $DIR/if-without-else-as-fn-expr.rs:44:5
149 LL | fn foo3_let(bar: usize) -> usize {
150 | ----- expected `usize` because of this return type
151 LL | / if let 0 = 1 {
154 | |_____^ expected usize, found ()
156 = note: expected type `usize`
158 = note: `if` expressions without `else` evaluate to `()`
159 = help: consider adding an `else` block that evaluates to the expected type
161 error: aborting due to 12 previous errors
163 Some errors have detailed explanations: E0308, E0317.
164 For more information about an error, try `rustc --explain E0308`.