let v: Vec<i32> = vec![1, 2, 3].into_iter().map(|x:i32| -> i32 {
let res = x + 1;
res;
}).rev().collect();
print!("{:?}", v)
I have this code, and get compile error
--> src\main.rs:8:68
|
8 | let v: Vec<i32> = vec![1, 2, 3].into_iter().map(|x:i32| -> i32 {
| ____________________________________________________________________^
9 | | let res = x + 1;
10 | | res;
| | - help: consider removing this semicolon
11 | | }).rev().collect();
| |_____^ expected i32, found ()
|
= note: expected type `i32`
found type `()`
I can't understand, why found type ()
How it work? Why this happens?