Closed
Description
the function like this is ok:
fn test() -> bool {
let a = {true} && true;
a
}
but when is become this, there is an error:
fn test() -> bool {
{
// this is some thing return bool
true
} && true
}
the error is:
error[E0308]: mismatched types
--> src/main.rs:4:5
|
4 | true
| ^^^^ expected (), found bool
|
= note: expected type `()`
found type `bool`
error[E0308]: mismatched types
--> src/main.rs:6:7
|
1 | fn test() -> bool {
| ---- expected `bool` because of return type
...
6 | } && true
| ^^^^^^^ expected bool, found &&bool
|
= note: expected type `bool`
found type `&&bool`
error: aborting due to 2 previous errors
Metadata
Metadata
Assignees
Labels
No labels