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
-
12
1
error[E0317]: if may be missing an else clause
13
2
--> $DIR/if-without-else-as-fn-expr.rs:2:5
14
3
|
@@ -24,20 +13,8 @@ LL | | }
24
13
= note: `if` expressions without `else` evaluate to `()`
25
14
= help: consider adding an `else` block that evaluates to the expected type
26
15
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
-
39
16
error[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
41
18
|
42
19
LL | let x: usize = if bar % 5 == 0 {
43
20
| _________-__________^
@@ -52,19 +29,8 @@ LL | | };
52
29
= note: `if` expressions without `else` evaluate to `()`
53
30
= help: consider adding an `else` block that evaluates to the expected type
54
31
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
-
66
32
error[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
68
34
|
69
35
LL | fn foo3(bar: usize) -> usize {
70
36
| ----- expected `usize` because of this return type
@@ -78,19 +44,8 @@ LL | | }
78
44
= note: `if` expressions without `else` evaluate to `()`
79
45
= help: consider adding an `else` block that evaluates to the expected type
80
46
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
-
92
47
error[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
94
49
|
95
50
LL | fn foo_let(bar: usize) -> usize {
96
51
| ----- expected `usize` because of this return type
@@ -104,20 +59,8 @@ LL | | }
104
59
= note: `if` expressions without `else` evaluate to `()`
105
60
= help: consider adding an `else` block that evaluates to the expected type
106
61
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
-
119
62
error[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
121
64
|
122
65
LL | let x: usize = if let 0 = 1 {
123
66
| _________-__________^
@@ -132,19 +75,8 @@ LL | | };
132
75
= note: `if` expressions without `else` evaluate to `()`
133
76
= help: consider adding an `else` block that evaluates to the expected type
134
77
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
-
146
78
error[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
148
80
|
149
81
LL | fn foo3_let(bar: usize) -> usize {
150
82
| ----- expected `usize` because of this return type
@@ -158,7 +90,6 @@ LL | | }
158
90
= note: `if` expressions without `else` evaluate to `()`
159
91
= help: consider adding an `else` block that evaluates to the expected type
160
92
161
- error: aborting due to 12 previous errors
93
+ error: aborting due to 6 previous errors
162
94
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