Open
Description
The following fails to compile:
pub fn main() {
let mut xs = HashMap::<(u32, u32), u32>::new();
let new_el = |&_| 30; // error: the type of this value must be known in this context
xs.insert((1,1), 10);
xs.insert((2,2), 20);
xs.find_or_insert_with((3,3), new_el);
println!("{}", xs);
}
The argument type must be explicitly spelled out:
let new_el = |_: &(u32, u32)| 30;
Should the type inference work here?