]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/expr-as-stmt-2.stderr
Merge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup
[rust.git] / src / test / ui / parser / expr-as-stmt-2.stderr
1 error[E0308]: mismatched types
2   --> $DIR/expr-as-stmt-2.rs:3:26
3    |
4 LL |     if let Some(x) = a { true } else { false }
5    |     ---------------------^^^^-----------------
6    |     |                    |
7    |     |                    expected `()`, found `bool`
8    |     expected this to be `()`
9    |
10 help: you might have meant to return this value
11    |
12 LL |     if let Some(x) = a { return true; } else { false }
13    |                          ^^^^^^     ^
14
15 error[E0308]: mismatched types
16   --> $DIR/expr-as-stmt-2.rs:3:40
17    |
18 LL |     if let Some(x) = a { true } else { false }
19    |     -----------------------------------^^^^^--
20    |     |                                  |
21    |     |                                  expected `()`, found `bool`
22    |     expected this to be `()`
23    |
24 help: you might have meant to return this value
25    |
26 LL |     if let Some(x) = a { true } else { return false; }
27    |                                        ^^^^^^      ^
28
29 error[E0308]: mismatched types
30   --> $DIR/expr-as-stmt-2.rs:6:5
31    |
32 LL |   fn foo(a: Option<u32>, b: Option<u32>) -> bool {
33    |                                             ---- expected `bool` because of return type
34 LL |       if let Some(x) = a { true } else { false }
35    |       ------------------------------------------ help: parentheses are required to parse this as an expression: `(if let Some(x) = a { true } else { false })`
36 ...
37 LL | /     &&
38 LL | |     if let Some(y) = a { true } else { false }
39    | |______________________________________________^ expected `bool`, found `&&bool`
40
41 error: aborting due to 3 previous errors
42
43 For more information about this error, try `rustc --explain E0308`.