Closed
Description
fn main() {
let v = vec![1, 2, 3];
let v2: Vec<_> = v.into_iter().enumerate().map(|i, x| i).collect();
println!("{:?}", v2);
}
Currently, this produces a somewhat confusing error:
error[E0593]: closure takes 2 arguments but 1 argument is required
--> src/main.rs:3:48
|
3 | let v2: Vec<_> = v.into_iter().enumerate().map(|i, x| i).collect();
| ^^^ -------- takes 2 arguments
| |
| expected closure that takes 1 argument
which could potentially be improved for this common case (an N-tuple was expected, but the closure takes N arguments instead). This could extend to other cases where there is a tuple : multiple arguments mismatch.