#Rust .collect() cannot infer type?
let data = vec![1,2,3].iter().map(|x|x*x).collect();
^^^^ cannot infer type for `_`
The expression is ambiguous, because .collect() can create not just Vec, but HashMap, String, and others as well: https://doc.rust-lang.org/std/iter/trait.FromIterator.html
Specify the type you want. It's not necessary to type it in full, e.g. `Vec<_>` is enough.
let data: Vec<_> = iter.collect();
let data = iter.collect::<Vec<_>>();
Try it: https://is.gd/yMg2gs