1- error[E0308]: mismatched types
2- --> $DIR/if-without-else-as-fn-expr.rs:2:5
3- |
4- LL | / if bar % 5 == 0 {
5- LL | | return 3;
6- LL | | }
7- | |_____^ expected usize, found ()
8- |
9- = note: expected type `usize`
10- found type `()`
11-
121error[E0317]: if may be missing an else clause
132 --> $DIR/if-without-else-as-fn-expr.rs:2:5
143 |
@@ -24,20 +13,8 @@ LL | | }
2413 = note: `if` expressions without `else` evaluate to `()`
2514 = help: consider adding an `else` block that evaluates to the expected type
2615
27- error[E0308]: mismatched types
28- --> $DIR/if-without-else-as-fn-expr.rs:10:20
29- |
30- LL | let x: usize = if bar % 5 == 0 {
31- | ____________________^
32- LL | | return 3;
33- LL | | };
34- | |_____^ expected usize, found ()
35- |
36- = note: expected type `usize`
37- found type `()`
38-
3916error[E0317]: if may be missing an else clause
40- --> $DIR/if-without-else-as-fn-expr.rs:10 :20
17+ --> $DIR/if-without-else-as-fn-expr.rs:9 :20
4118 |
4219LL | let x: usize = if bar % 5 == 0 {
4320 | _________-__________^
@@ -52,19 +29,8 @@ LL | | };
5229 = note: `if` expressions without `else` evaluate to `()`
5330 = help: consider adding an `else` block that evaluates to the expected type
5431
55- error[E0308]: mismatched types
56- --> $DIR/if-without-else-as-fn-expr.rs:19:5
57- |
58- LL | / if bar % 5 == 0 {
59- LL | | 3
60- LL | | }
61- | |_____^ expected usize, found ()
62- |
63- = note: expected type `usize`
64- found type `()`
65-
6632error[E0317]: if may be missing an else clause
67- --> $DIR/if-without-else-as-fn-expr.rs:19 :5
33+ --> $DIR/if-without-else-as-fn-expr.rs:17 :5
6834 |
6935LL | fn foo3(bar: usize) -> usize {
7036 | ----- expected `usize` because of this return type
@@ -78,19 +44,8 @@ LL | | }
7844 = note: `if` expressions without `else` evaluate to `()`
7945 = help: consider adding an `else` block that evaluates to the expected type
8046
81- error[E0308]: mismatched types
82- --> $DIR/if-without-else-as-fn-expr.rs:27:5
83- |
84- LL | / if let 0 = 1 {
85- LL | | return 3;
86- LL | | }
87- | |_____^ expected usize, found ()
88- |
89- = note: expected type `usize`
90- found type `()`
91-
9247error[E0317]: if may be missing an else clause
93- --> $DIR/if-without-else-as-fn-expr.rs:27 :5
48+ --> $DIR/if-without-else-as-fn-expr.rs:24 :5
9449 |
9550LL | fn foo_let(bar: usize) -> usize {
9651 | ----- expected `usize` because of this return type
@@ -104,20 +59,8 @@ LL | | }
10459 = note: `if` expressions without `else` evaluate to `()`
10560 = help: consider adding an `else` block that evaluates to the expected type
10661
107- error[E0308]: mismatched types
108- --> $DIR/if-without-else-as-fn-expr.rs:35:20
109- |
110- LL | let x: usize = if let 0 = 1 {
111- | ____________________^
112- LL | | return 3;
113- LL | | };
114- | |_____^ expected usize, found ()
115- |
116- = note: expected type `usize`
117- found type `()`
118-
11962error[E0317]: if may be missing an else clause
120- --> $DIR/if-without-else-as-fn-expr.rs:35 :20
63+ --> $DIR/if-without-else-as-fn-expr.rs:31 :20
12164 |
12265LL | let x: usize = if let 0 = 1 {
12366 | _________-__________^
@@ -132,19 +75,8 @@ LL | | };
13275 = note: `if` expressions without `else` evaluate to `()`
13376 = help: consider adding an `else` block that evaluates to the expected type
13477
135- error[E0308]: mismatched types
136- --> $DIR/if-without-else-as-fn-expr.rs:44:5
137- |
138- LL | / if let 0 = 1 {
139- LL | | 3
140- LL | | }
141- | |_____^ expected usize, found ()
142- |
143- = note: expected type `usize`
144- found type `()`
145-
14678error[E0317]: if may be missing an else clause
147- --> $DIR/if-without-else-as-fn-expr.rs:44 :5
79+ --> $DIR/if-without-else-as-fn-expr.rs:39 :5
14880 |
14981LL | fn foo3_let(bar: usize) -> usize {
15082 | ----- expected `usize` because of this return type
@@ -158,7 +90,6 @@ LL | | }
15890 = note: `if` expressions without `else` evaluate to `()`
15991 = help: consider adding an `else` block that evaluates to the expected type
16092
161- error: aborting due to 12 previous errors
93+ error: aborting due to 6 previous errors
16294
163- Some errors have detailed explanations: E0308, E0317.
164- For more information about an error, try `rustc --explain E0308`.
95+ For more information about this error, try `rustc --explain E0317`.
0 commit comments